My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Showing posts with label copy. Show all posts
Showing posts with label copy. Show all posts

Friday, August 31, 2012

SCP command for secure copy or transfer of files between two machines or servers.


Sometimes it is required to copy files from or to a remote server. Sometimes you may also want to copy files from one remote server to another remote server, without passing traffic through your PC. scp command line utility is a neat tool/command to securely copy files over ssh, between Linux, Mac or Windows.

It is important to note here that scp stands for secure cp (copy). It means that you can copy files across ssh connection. The connection will be securely encrypted, it is a very secure way to copy files between computers

Syntax of SCP command:

scp [[user@]from-host-addr:]source-file [[user@]to-host-addr:][destination-file]

from-host-addr
Is the name or IP of the host where the source file is, this can be omitted if the from-host is the host where you are actually issuing the command
user
Is the user which have the right to access the file and directory, that is supposed to be copied in the case of the from-host, and the user who has the rights to write in the to-host
from-host-addr
Is the name or IP of the destination where the source file is, this can be omitted if the from-host is the host where you are actually issuing the command
source-file
Is the file or files that are going to be copied to the destination host, it can be a directory but in that case you need to specify the -r option to copy the contents of the directory
destination-file
Is the name that the copied file is going to take in the to-host, if none is given all copied files are going to keep its names

There are a few options which you can explore on your own. Like –p , -q, -r (for directory) and –v etc.

My small example:
scp -r user@x.x.x.x:/anwar/jamal/faiz /destination/folder/on/present/machine
Then it asks for password for user on machine x.x.x.x.
Give that. And, see task being accompalished!!

Some quick SCP commands variation that I use are as follows:

Following is going to copy all files with .txt extension to the folder /home/user in the abc.server.com host
scp *.txt user@abc.server.com:/home/user/

Following is going to copy all file from server to ur computer
scp username@server:/home/username/file_name /home/local-username/file-name

Following is used to copy files from a remote server to another remote computer
scp user_name1@server1:/home/user_name1/file_name user_name2@server2:/home/user_name2/
In above command files are copied from one server to the other. They are not going to pass through your computer. The data flow traffic is going to pass from one server to the other directly.
:) Cheers 
Anwar Jamal faiz

Wednesday, June 22, 2011

Access copy Share files between Host and guest file system in VMware virtual machine

There is definitely ways to achieve the task. It all depends on the choice of the host machine you are using and the guest OS in the VMware. Just keep in mind the following matrix:






HostGuestTool
WinWinwindows file sharing
WinLinuxsamba, ssh
linuxwinsmbmount
linuxlinuxnfs,ftp,telnet

The same above in graphics is

To summarize:
# If Both systems run Windows operating system, you can use Windows file sharing
# If You are connecting from a Linux system to a Windows system, you can use smbmount
# If You are connecting from a Windows system to a Linux system, use Samba
# If Both systems run Linux operating systems, use NFS, FTP and Telnet

For more detailed description you can also visit VMWare official website document on this topic at the following location. Click Here for VMWare Help

In order to share folders between the host operating system and the guest operating system you can use VMWare settings. Go to VM->Settings->options

The same is shown in the adjacent snapshot.
Added notes in July 2012 :-- VMware Workstation 4 Features | Documentation | Knowledge Base | Discussion Forums Prev Contents Last Next Using Shared Folders With shared folders, you can easily share files among virtual machines and the host computer. To use shared folders, you must have the current version of VMware Tools installed in the guest operating system and you must use the Virtual Machine Control Panel to specify which directories are to be shared. You can use shared folders with virtual machines running the following guest operating systems: Windows Server 2003 Windows XP Windows 2000 Windows NT 4.0 Linux with a kernel version of 2.4 or higher To set up one or more shared folders for a virtual machine, be sure the virtual machine is open in Workstation and click its tab to make it the active virtual machine. Go to Edit > Virtual Machine Settings > Options and click Shared folders. You can add one or more directories to the list. Those directories may be on the host computer or they may be network directories accessible from the host computer. In a Windows virtual machine, shared folders appear in My Network Places (Network Neighborhood in a Windows NT virtual machine) under VMware Shared Folders. For example, if you specify the name Test files for one of your shared folders, you can navigate to it by opening My Network Places > VMware Shared Folders > .host > Shared Folders > Test files. You can also go directly to the folder using the UNC path \\.host\Shared Folders\Test files. You can map a shared folder to a drive letter just as you would with a network share. Note: To see shared folders displayed in this way, you must update VMware Tools in the virtual machine to the current version. If your guest operating system has the version of VMware Tools that shipped with VMware Workstation 4.0, shared folders appear as folders on a designated drive letter. In a Linux virtual machine, shared folders appear under /mnt/hgfs. So the shared folder in this example would appear as /mnt/hgfs/Test files.

Vmware and sharing rocks!!