Access denied, Please sign in and make sure you have proper permission.
第 4 步的输入密码是指 SSH 登录时的密码吗?将你的公钥复制到第二步中设置的 ssh_user 的 home 目录下的 .ssh/authorized_keys,登录时就不需要密码了。
#1 楼 @alvin2ye
#2 楼 @_samqiu
我试了 1L 的方法,问题已解决,谢谢楼上两位的帮助!
在 Mac OS X 下:
步骤 1: 用 ssh-key-gen 在本地主机上创建公钥和密钥(如果已建请忽略)
$ ssh-keygen -t rsa
步骤 2: 安装 ssh-copy-id
$ brew install ssh-copy-id
步骤 3: 用 ssh-copy-id 把公钥复制到远程主机上
# [注: ssh-copy-id 把密钥追加到远程主机的 .ssh/authorized_key 上]
$ ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote-host
步骤 4: 直接登录远程主机
$ ssh user@remote-host
# 此时便可直接登录[SSH不会再询问密码]
$ user@remote-host
...