Linux Pathfinder: Linux Howtos and Tutorials

How to Configure SSH and SCP Without Prompting Password

How to Configure SSH and SCP Without Prompting Password
Configure SSH and SCP Without Prompting Password

Secure SHELL is the most trusted network protocol. SSH is used to login from local linux servers to remote servers. Secure Copy (SCP) Protocol is also used to transfer files from local to remote servers.

In this tutorial we will describe how to configure ssh and scp without prompting password. There are simple settings to SSH association between your local server and the remote server. Without prompting password with SSH increase the trust between two servers for easy file sync or transfer.

Here, we will setup SSH without entering password automatic login from server as user linuxpathfinder to with user asiface.

Create Authentication SSH-Keygen Keys on (

First of all you will login into server with user linuxpathfinder and generate a pair of public keys as shown below.

$ ssh-keygen -t rsa

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

Create .ssh Directory on (

Use SSH (Secure Shell) command from server to connect server using username asiface and create .ssh directory under it as shown below.

$ ssh asiface@ mkdir -p .ssh

The authenticity of host ' (' can't be established.
 RSA key fingerprint is c7:53:83:43:b3:cf:d8:e2:b0:0d:50:7b:13:32:29:3d.
 Are you sure you want to continue connecting (yes/no)? yes
 Warning: Permanently added '' (RSA) to the list of known hosts.
 asiface@'s password: [Enter Your Password Here]

Upload Generated Public Keys to (

Use Secure Shell command from server and upload newly generated public key ( on server under asiface’s .ssh directory as a file name authorized_keys.

$ cat .ssh/ | ssh asiface@ ‘cat >> .ssh/authorized_keys’

asiface@’s password: [Enter Your Password Here]

Set Permissions on (

Note that depending on your different version of Secure Shell on servers, we might also have to set the permissons on .ssh directory and authorized_keys file.

Set the permissions of (.ssh) to 700
Set the permissions of (.ssh/authorized_keys) to 640

$ ssh asiface@ “chmod 700 .ssh; chmod 640 .ssh/authorized_keys”

asiface@’s password: [Enter Your Password Here]

Login from to Server without Password

From now on you can log into as asiface user from server as linuxpathfinder user without password:

$ ssh asiface@

[ /]$ [SSH prompt on asiface@]

The procedure to setup SSH association between and is completed.

Transfer a File/Folder Without Entering Password

From now onwards you will also be able to transfer a file/folder from to the without entering any password.

$ scp testfile asiface@

testfile           100%    5     0.0KB/s   00:00 [testfile transferred]


Share this article:

Asif Khan's picture
I am an experienced Linux System and Network Administrator with having more than 10 years of experience. My primary responsibilities are to keep up and running Linux system environment, backups important data with scripting and configuration management on AWS Linux server environments. My aim is to help people, in finding their path towards a solution to their problems. Well, I believe helping others can good for both parties, to them and to you as well. That day and today is the day that thousands of people seek help from my website to help people find answers to their questions. I am sure that everyone will get all the answers to their questions related to software and operating system, and this website will help you keep your system updated.

Add new comment


Enter the characters shown in the image.