Categories

(83)
(69)
(8)
(34)
(74)
(149)

SSH access without password

29.03.2011
SSH access without password
Author:

SSH is a network protocol of session layer that allows for a remote control of operating system and TCP-connection tunneling (e.g. in the cases of files exchange).

SSH, also, provides for safe transfer of practically any other network protocol in the unprotected environment.

Very often, for the purpose of managing, when one has to log into a particular computer (or server) the latter generates a password request. In a situation when the logging needs to be performed often,  entering the same thing over and over again is quite annoying. And what if you have to access many servers and each of them asks for a unique password?

SSH protocol makes it possible to log into a remote server without entering password (it comes handy, e.g., in the cases of reserve copying and file publication, etc.).

Needless to say that it only takes the above to handle the password issue, for the public key user identification serves for that purpose, too, (the key that will serve as any the user identifier to be recognized by the remote computer).

1. First a web developer has to create a pair of keys - public and private -  for the specific user on the client computer.

It's done with the help of utility ssh-keygen.

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):                # Путь где будет сохранен наш ключ <Enter>
Created directory '/home/user/.ssh'.                                                                
Enter passphrase (empty for no passphrase):                                               # Пароль для защиты ключа, если пусто - без пароля
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
63:4b:1c:ea:30:f3:d5:c8:3c:77:73:ea:bb:9c:6f:64 user@client
The key's randomart image is:
+--[ RSA 2048]----+
|        .                   |
|       = +                |
|    + . S o o            |
|     * + = . +E         |
|      o .   .o             |
|           o               |
|        *=.               |
+-----------------+

To have the key generated, we have used a cryptographic algorithm RSA

The two keys will appear in: id_rsa and id_rsa.pubIn home directory in subcategory .ssh 

2. Then we have to copy our open key (id_rsa.pub) on the server, and we'll do the next command for that

$  ssh-copy-id [email protected]

or else, we just copy-paste our public key file into the same server the following way

$ scp ~/.ssh/id_rsa.pub [email protected]:/home/username/.ssh/authorized_keys_user

After that, we can log into the remote computer without entering a password.

$ ssh [email protected]

But sometimes, when the server access port happens to have been changed, the situation gets no more standard. For such cases we need to make use of the key - p XXXX where XXXX is access port to server.

6 votes, Rating: 5

Read also

1

If you know what jQuery is or you just start studying it, then you’ll definitely be interested in how to write your own jQuery plugin. It’s very easy to do that. You’ll be able to create your own...

2

When registering on a site a user will normally be asked for password verification which is required in Drupal by default.

3

It happens very often that sorting on a specific criterion should be done. Views, Nodequeue, Flag and other similar modules are used for that. But sometimes functional of these modules is not...

4

Pressflow is Drupal’s distributive that provides advanced efficiency and scaling. It’s developed by the guys from Four Kitchens Company.

5

I was asked many times how to translate element <Any> in drop-down list in filter of views module. Yes! It can’t be done in a standard way by interface translation.

Subscribe to our blog updates