Tuesday, February 12, 2008

Secure system to system file copies without Samba or NFS

What if you need to copy files from one system to another, but don't want to bother with setting up file shares (SAMBA or NFS)? It's actually very quick and simple.

All you need is the scp command. The tricky part is getting the syntax correct, but I'll help you with that. For this example, let's just say you're copying a file from one user's desktop to another user's desktop. Here's how you would do it.....

scp filename username@remotesystem:/home/username/Desktop/

Once you provide this command, it will ask you for the password on the remote system. Of course you need the correct credentials or it will fail.

Now, if you want to copy from the other system to your system, you can do that as well, with a quick command line switch.
scp -r filename username@remotesystem:/home/username/Desktop/filename .
Keep this command all together. Long commands tend to breakup in small formats like this.
The -r indicates that you're copying from the remote system to the local system instead of the other way around. Also, the period at the end of the command indicates that you're copying to the current directory. Without a destination directory, the command will not work, so this is important. You could put any location there as long as you have proper permission. Enjoy.

No comments: