求助,关于SSH
Tofloor
poster avatar
lygjxh
deepin
2017-07-10 19:06
Author
已cat >>将PEM密钥导入autorized_keys,权限也设置了700,
但是链接时候还是提示Permission denied (publickey).
请问怎么回事啊?
Reply Favorite View the author
All Replies
avatar
jantacy
deepin
2017-07-10 19:27
#1
远程的.ssh目录755,autorized_keys文件644
Reply View the author
avatar
jantacy
deepin
2017-07-10 19:30
#2
700和600好像也行
Reply View the author
avatar
lygjxh
deepin
2017-07-10 19:31
#3
https://bbs.deepin.org/post/142290
远程的.ssh目录755,autorized_keys文件644

你好,谢谢回复,
我去WIN系统用XSHELL试下改成755,这边在改成644试试。
Reply View the author
avatar
lygjxh
deepin
2017-07-10 19:32
#4

之前设置的就是700和600,但是不是远程的700,而是本地的.shh700.。。。
Reply View the author
avatar
duanyao
deepin
2017-07-10 19:33
#5
是 authorized_keys 和 600 才对。
而且你提供的信息太少,不要惜字如金:服务器端和客户端各是怎么配的,执行的命令是什么,完整的控制台输出等,都说出来。
Reply View the author
avatar
lygjxh
deepin
2017-07-10 19:43
#6
https://bbs.deepin.org/post/142290
是 authorized_keys 和 600 才对。
而且你提供的信息太少,不要惜字如金:服务器端和客户端各是怎么配的, ...

谢谢,
服务器端是用的亚马逊云,小白完全按照网上教程做的。
之前WIN下用的XSHELL登录的,我以为能登录,就是服务器端有秘钥,不需要设置了。
Reply View the author
avatar
duanyao
deepin
2017-07-10 19:52
#7
https://bbs.deepin.org/post/142290
谢谢,
服务器端是用的亚马逊云,小白完全按照网上教程做的。
之前WIN下用的XSHELL登录的,我以为能登录 ...

把你的个人秘钥和公钥文件从 windows 那边复制到过来,放到linux主目录下的 .ssh 目录下,文件名是 id_rsa 和 id_rsa.pub 。根据算法的不同,其中 rsa 也可能是其它的,例如 ed25519。然后在终端执行
ssh -vvv root@<服务器端IP>
如果要登录的用户名不是 root 请相应修改。如果登录失败,把输出都贴出来。
Reply View the author
avatar
lygjxh
deepin
2017-07-10 20:03
#8
https://bbs.deepin.org/post/142290
把你的个人秘钥和公钥文件从 windows 那边复制到过来,放到linux主目录下的 .ssh 目录下,文件名是 id_rs ...

当时从亚马逊云下载的秘钥只有一个xxx.pem文件啊
Reply View the author
avatar
duanyao
deepin
2017-07-10 20:13
#9
本帖最后由 duanyao 于 2017-7-10 12:25 编辑
https://bbs.deepin.org/post/142290
当时从亚马逊云下载的秘钥只有一个xxx.pem文件啊

那么大概是:
ssh -i /path/my-key-pair.pem https://bbs.deepin.org/module

http://docs.aws.amazon.com/AWSEC ... InstancesLinux.html

另外 xxx.pem文件需要设置 400 权限。
最后,你可以把 xxx.pem 文件放到主目录下的 .ssh 目录下,然后执行
ssh-add ~/.ssh/xxx.pem
之后就只需要用 ssh ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com 登录,不需要再指定 pem 文件。参考:
https://stackoverflow.com/questi ... ce-permission-error
Reply View the author
avatar
lygjxh
deepin
2017-07-10 21:33
#10
https://bbs.deepin.org/post/142290
那么大概是:
ssh -i /path/my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com

多谢,真的成功了,原来官方也有说明。

Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-1020-aws x86_64)

* Documentation:  https://help.ubuntu.com
* Management:     https://landscape.canonical.com
* Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

18 packages can be updated.
0 updates are security updates.


*** System restart required ***
Last login: Mon Jul 10 03:55:41 2017 from
Reply View the author