我知道这个问题已被提出,但我确信我已经完成了所有其他答案的建议.
机器A:
>使用keygen -t rsa在〜/ .ssh /中创建id_rsa.pub
>将计算机A的id_rsa.pub复制到计算机B用户的主目录
>制作id_rsa.pub 600的文件权限
机器B.
>将机器A的pub键添加到authorised_keys和authorised_keys2:cat~ / id_rsa.pub>>的〜/ .ssh / authorised_keys2
>制作了id_rsa.pub 600的文件权限
我还确保两个.ssh目录在机器A和B上都具有权限700.
如果我尝试从机器A登录到机器B,我会被要求输入密码,而不是ssh密码短语.
我让两台机器上的root用户使用无密码ssh互相交谈,但我无法让普通用户这样做.
双方的用户名是否必须相同?还是有一些我错过的设置.
机器A是在Windows 7 PC上的VirtualBox内运行的Ubuntu 10.04虚拟机,机器B是专用的Ubuntu 9.10服务器
更新:我使用选项-vvv运行ssh,它提供了许多输出行,但这是最后几个命令:
debug3: check_host_in_hostfile: filename /home/pete/.ssh/known_hosts debug3: check_host_in_hostfile: match line 1 debug1: Host '192.168.1.19' is known and matches the RSA host key. debug1: Found key in /home/pete/.ssh/known_hosts:1 debug2: bits set: 504/1024 debug1: ssh_rsa_verify: signature correct debug2: kex_derive_keys debug2: set_newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug3: Wrote 16 bytes for a total of 1015 debug2: set_newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug3: Wrote 48 bytes for a total of 1063 debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: /home/pete/.ssh/identity ((nil)) debug2: key: /home/pete/.ssh/id_rsa (0x7ffe1baab9d0) debug2: key: /home/pete/.ssh/id_dsa ((nil)) debug3: Wrote 64 bytes for a total of 1127 debug1: Authentications that can continue: publickey,password debug3: start over,passed a different list publickey,password debug3: preferred gssapi-keyex,gssapi-with-mic,gssapi,publickey,keyboard-interactive,password debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Trying private key: /home/pete/.ssh/identity debug3: no such identity: /home/pete/.ssh/identity debug1: Offering public key: /home/pete/.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet,wait for reply debug3: Wrote 368 bytes for a total of 1495 debug1: Authentications that can continue: publickey,password debug1: Trying private key: /home/pete/.ssh/id_dsa debug3: no such identity: /home/pete/.ssh/id_dsa debug2: we did not send a packet,disable method debug3: authmethod_lookup password debug3: remaining preferred:,password debug3: authmethod_is_enabled password debug1: Next authentication method: password
使用ssh-copy-id复制密钥;它将创建任何必要的文件/目录并修复任何破坏的权限.
原文链接:https://www.f2er.com/ubuntu/347642.html