Copy Files remotely on SSH without Password
Whenever you control your computer remotely, SSH act as a life saver. Most of you people don’t know that you can download and uploads files too. May be you also don’t know. Using SSH keys, you don’t need to enter passwords. The method works fine on MAC OS X and Linux operating system. Proper SSH configuration is must for both OS.
How to copy files on SSH
Basic format for secure copy command is “scp [options] original_file destination_file”. When you need to address remote file, you have to write in the order given as: “user@server:path/to/file”
Don’t be confused with server as it can be an IP address or URL. Let’s take an example to show this concept clearly
scp –P 40050 Desktop/url.txt email@example.com:~/Desktop/url.txt
In this command, -P lets you to write a port number instead of giving it a default value as 22. Now see the original file is “url.txt” and located in “Desktop” directory as it is also clear from above command. “yatri” user is running the command on server “192.168.1.50”. You can copy file from remote computer to desktop.
It is annoying to write password for accessing remote computer that you use all the time. You have two key files. One is public and belongs to remote server while other is private that needs to be secure. These key files can be used instead of entering password. Enter command “ssh-keygen –t rsa”. Put generated keys in “~/.ssh/”. Enter passphrase and copy public key file to remote computer.