fabric 使用SSH keyfile登录两台远程服务器

是不是生成的id_rsa.pub都放在远程服务器的~/.ssh/authorized_keys下就可以了?
我有一台是成功的,可是另一台怎么都不行,非要输密码,请问这是什么情况?
至尊宝的传说
浏览 423回答 2
2回答

慕容森

放在「~/.ssh/authorized_keys下」?应该是放它里边。它应该是个文件,一行一个公钥。授权失败的话,请检查系统日志。另外注意~/.ssh的权限应该是700,当然所有者也不能错。

互换的青春

首先使用ssh-i/path/to/keyfileuser@host1和host2-vvvv,分别查看你能否登录这两台机器以及成功使用的keyfile....debug1:Tryingprivatekey:/Users/xxx/.ssh/host1.pemdebug1:readPEMprivatekeydone:typeRSAdebug3:sign_and_send_pubkey:RSA30:a9:37:b5:c4:ad:8a:b4:c8:64:f7:fb:c1:7d:48:62debug2:wesentapublickeypacket,waitforreplydebug1:Authenticationsucceeded(publickey).Authenticatedtohost1....fabricfromfabric.apiimport*env.hosts=['host1','host2']env.user='user'env.key_filename='/path/to/keyfile.pem'run('uname-a')
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript