ssh protocol 2:
1. Create a DSA or RSA key named foo. As of version 3.0 of the ssh.com server includes support for RSA keys.
$ cd ~/.ssh
$ ssh-keygen -t dsa -f foo
2. Convert the DSA or RSA key into “SECSH Public Key File Format,” the format used on an ssh.com server.
$ ssh-keygen -e -f foo > foo.pub
3. Copy the foo.pub file to the ssh.com server.
$ scp foo.pub user@ssh.com_host:.ssh2
If the remote server only allows ssh protocol 2, you may receive the following errors:
scp: warning: Executing scp1 compatibility.
scp: FATAL: Executing ssh1 in compatibility mode failed (Check that scp1 is in your PATH).
lost connection
Use sftp instead to transfer the key:
$ sftp user@ssh.com_host
put foo.pub .ssh2
4. Add the appropriate ~/.ssh2/authorization file entry in the ssh.com server.
$ ssh user@ssh.com_host ‘echo “key foo.pub” >> .ssh2/authorization’
5. Login to the ssh.com server using the foo identity.
$ ssh -o IdentityFile2=~/.ssh/foo user@ssh.com_host
Все делаю точно как написано, все равно просит пароль.
Где ошибка?
telnet на 22 порт показывает - SSH-2.0-OpenSSH_4.7
ssh protocol 2:
1. Create a DSA or RSA key named foo. As of version 3.0 of the ssh.com server includes support for RSA keys.
...
$ ssh-keygen -t dsa -f foo
В sshd_config для осуществления беспарольной аутентификации в положение "yes" должна быть выставлена только директива "PubkeyAuthentication", все остальные виды аутентификации должны стоять в "no"
SSH Авторизация по ключам
ssh безпарольный вход, авторизация по ключам,
$cd .ssh
$ssh-keygen -t dsa -f mysuperkey
пару раз enter (лечится -N '' )
потом cat mysuperkey >>id_dsa
$chmod 600 id_dsa
$scp mysuperkey.pub host:.ssh/
потом ssh host
и там уже
$cd .ssh
$cat mysuperkey.pub >>authorized_keys
$chmod 600 authorized_keys
и посмотреть в конфиге /etc/ssh/sshd_config
чтоб было вот так
RSAAuthentication yes (необязательно, но если ключи будут RSA ...)
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
--
ну и рестартануть sshd (не обязательно, но на всяк случай не помешает)
ssh-keygen -t rsa
Enter passphrase (empty for no passphrase) - оставляем пустым (просто жмем enter)
копируем свое содержимое ~/.ssh/id_rsa.pub на сервер в ~/.ssh/authorized_keys
и обязательно отключаем selinux (сервер надо будет перегрузить), иначе ключи работать не будут