Я начинаю делать сессию SSH без пароля. Теперь я могу подключиться к своему серверу следующим образом:
bash-3.2$ ./dev2
Enter passphrase for key '/Users/roger/.ssh/id_rsa':
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 2.6.32-042stab120.11 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
0 packages can be updated.
0 updates are security updates.
Last login: Wed Aug 23 08:25:06 2017 from 176.59.142.224
Теперь я редактирую sshd_config и добавляю в конец следующее:
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
Перезагрузите сервер, но ssh по-прежнему запрашивает у меня парольную фразу.
Что мне делать?
В этом случае
при создании вы передаете парольную фразу
, поэтому, если вы подключаетесь без парольной фразы
при SSH, вы должны создать новый ключ с помощью команды как :
**[test@test test]$ ssh-keygen**
Generating public/private rsa key pair.
Enter file in which to save the key (/home/test/.ssh/id_rsa):
Created directory '/home/test/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/test/.ssh/id_rsa.
Your public key has been saved in /home/test/.ssh/id_rsa.pub.
The key fingerprint is:
ac:5e:9a:72:c6:cd:82:9c:cd:1f:bc:4d:de:f9:50:d9 tanto@hlink_backup_086
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| . o |
| S o E|
| o . |
| . *.o+ . . |
| =.B+o* . o |
| ++oo o o.. |
+-----------------+
На шаге введите парольную фразу,
вы должны ввести пустую. После создания вы можете добавить ключ id_rsa.pub
в папку .ssh / authorized_keys
удаленного сервера, а также проверить права доступа и изменить файл authorized_keys с помощью chmod 600:
[root@test test]# chmod -R 600 /home/test/.ssh/authorized_keys
[root@test test]# ls -l /home/test/.ssh/authorized_keys
-rw------- 1 test test 1212 Jul 12 14:17 /home/test/.ssh/authorized_keys