ssh链接机器是报错:
- ssh -p 29418 root@192.168.149.91
- Permission denied (publickey).
ssh-keygen -t rsa -c "admin" -f ~/.ssh/root
原因是上面这个命令生成密钥的时候指定了密钥的文件root,而系统默认的密钥文件名为:id_rsa,所以系统会出现以上错误。
解决办法:
1、使用默认密钥文件名id_rsa
2、vim /etc/ssh/ssh_config文件IdentityFile项设置密钥文件为:
IdentityFile ~/.ssh/root
如下成功:
- [root@localhost .ssh]# ssh -p 29418 root@192.168.149.91
-
- **** Welcome to Gerrit Code Review ****
-
- Hi admin, you have successfully connected over SSH.
-
- Unfortunately, interactive shells are disabled.
- To clone a hosted Git repository, use:
-
- git clone ssh://root@localhost:29418/REPOSITORY_NAME.git