SCP, SSH and RSYNC Without Prompting for Password

scp ssh and rsync without prompting for password
Normally SCP, SSH and Rsync needs password to transfer files. This article will help you to SCP, SSH and Rsync without prompting for password.

Want to  SCP SSH and Rsync without prompting for password? Follow the steps given below.


In this case, Server “S” is the source or local server, and Server “R” is the remote or destination server.

1) First thing you have to do is to log in to the “S” server and create pair of authentication keys using the “ssh-keygen” tool.

ssh-keygen generates, manages, and converts authentication keys for ssh.

ssh-keygen can create RSA keys for use by SSH protocol version 1 and RSA ( RSA stands for Ron Rivest, Adi Shamir, and Leonard Adleman, who first publicly described the algorithm in 1977 ) or DSA ( Digital Signature Algorithm (DSA) is a United States Federal Government standard or FIPS for digital signatures. ) keys for use by SSH protocol version 2. The type of key to be generated is specified with the -t option.

If invoked without any arguments, ssh-keygen will generate an RSA key for two connections in the SSH protocol. So now you know what it is, and it’s time to create the authentication keys. ( You don’t have to type any passphrase )

S:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/s/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/s/.ssh/id_rsa.
Your public key has been saved in /home/s/.ssh/
The key fingerprint is:
The key's randomart image is:
+--[ RSA 2048]----+
| ..o |
| o * |
| o + * |
| o + X |
| + * S |
| o + |
| o . |
| .E. . |
| ooo.. |


2) Now, you have created a unique SSH authentication key using the RSA algorithm and stored it in “/home/s/.ssh/id_rsa”. Let’s copy this public key to remote machine “R” using the “ssh-copy-id tool.

ssh-copy-id is a script that uses ssh to log into a remote machine.

It also changes the permissions of the remote user’s home, ~/.ssh, and ~/.ssh/authorized_keys to remove group write ability (which would otherwise prevent you from logging in if the remote sshd has StrictModes set in its configuration).

If the -i option is given, the identity file (defaults to ~/.ssh/ is used, regardless of whether there are any keys in your ssh-agent. So, in this case, we are using the “-i” switch to make this easy. ( Just provide the password when it asks for. )

S:~$ ssh-copy-id -i r@remote_machine

Now try logging into the machine, with “ssh ‘r@remote_machine'”, and check-in:



To make sure we haven’t added extra keys that you weren’t expecting.


That’s it!! That’s how you do SCP SSH and Rsync without prompting for the password. Please test it and verify the working.

Share this post

Services to Explore

Stay up to date!

Stay up to date with the Web Hosting, Cloud and Server Management Industry News and Tutorials!

We will send you only the relevant emails, and we respect your privacy. Please review our privacy policy for more info.

Linux Management Services

Focus on your business, and let us take care of your Linux Servers!
From what you are reading, it seems you are interested in Linux and related technologies. If you have a moment to spare, please take a look at our Linux Management Services plan, which might interest you even more!
Linux Management Plan

Value-Added Services

We have services that can help you run a successful business. With us, you don't have to worry about these areas because our experts will take care of it for you.

ServerHealers uses cookies.