Ubuntu Blog – Latest informations

Just another WordPress.com site

How to: connect to host Linux without a password (authentication key)


This how-to will show you how you connect to a Linux machine via SSH using a key, instead of the password. This is very useful for creating scripts to connect to the machines for file transfer, backup and more and save you the work of the password every time SSH to a machine type.

This guide assumes that you have an SSH server configuration in “Server” and an SSH client to configure the client.(sudo apt-get install openssh-server & sudo apt-get install openssh-client, respectively)

Firstly, by the client, run the following command on record with your normal user account:


(The password blank if you do not want to provide the login, but remember to save the certificate that is created with your life when you open the door for someone who finds you …)

This creates and id_rsa id_rsa.pub are automatically converted to the directory ~/SSH.

Then we want to load the pub external file host/server to which you want to connect:

SCP ~/.ssh/id_rsa.pub remoteuser @ remotehost was contained: ~/

Now that you’ve uploaded may allow connection to the remote computer (ssh user @ remotehost was contained) and perform the following on the remote host:

Cat > pub > id_rsa.~/.ssh/authorized_keys

and then:

RM id_rsa.pub

delete the uploaded file.

If the authentication of the remote host key is not enabled (default), machine and change the ssh configuration file as such:

Nano sshd_config

and add/change the following options such as:

RSAAuthentication Yes
PubkeyAuthentication Yes

Then Reload the configuration:


You are now ready to test to make sure that you can via the main open and if necessary, you can disable password authentication.

Change the setting again:

Nano sshd_config

and set the following options:

ChallengeResponseAuthentication not
PasswordAuthentication no
Setting usepam not

Reload the configuration:


It is now on its way to more secure/hassle free SSH authentication.

Technorati Tags: SSH key authentication,


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


This entry was posted on October 12, 2010 by and tagged , , , , .
%d bloggers like this: