问题描述:
- 在Linux上新建了一个用户
useradd -aG wheel someone
- 在
/home/someone
中新建.ssh/authorized_keys
‘ - 将本地 id_rsa.pub 文件copy到远程主机;看着这个log就有种不祥的预感
/ # ssh-copy-id jduc@101.124.7.232 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed expr: warning: '^ERROR: ': using '^' as the first character of a basic regular expression is not portable; it is ignored /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys jduc@101.124.7.232's password:
- ssh 登录; 果然,ops
λ ssh someone@x.x.x.x someone@x.x.x.x's password:
解法
- 当然是Google喽, 原因是权限问题: .ssh 文件的权限需要时700, authorized_keys 权限是 600
chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
- 本地ssh 重新登录; perfect~
λ ssh someone@x.x.x.x Last login: Mon Jul 2 14:16:46 2018 from 111.200.23.14 Welcome to xxx Service [someone@FrontendProd ~]$
next
- 为什么是权限问题?