ssh无密码登录

来源:互联网 发布:剪辑音乐软件手机 编辑:程序博客网 时间:2024/06/10 18:55

生成ssh-keygen

>ssh-keygenGenerating public/private rsa key pair.Enter file in which to save the key (~/.ssh/id_rsa): ~/.ssh/id_rsa already exists.Overwrite (y/n)? yEnter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in ~/.ssh/id_rsa.Your public key has been saved in ~/.ssh/id_rsa.pub.The key fingerprint is:03:5f:cd:46:00:53:85:f4:1d:b7:b7:5f:cd:56:43:5b cbs@localhostThe key's randomart image is:+--[ RSA 2048]----+|        o+++o ..E||         ..= ..o+||      .   . = .+o||       o . .   .*||        S      .=||         .     .o||                .||                 ||                 |+-----------------+

生成了公钥~/.ssh/id_rsa.pub 私钥~/.ssh/id_rsa

输入命令

ssh user@host "cat >>~/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub

将公钥传递到远程主机,完成

原创粉丝点击