为普通用户添加公钥
1. 在home根目录建立目录、文件
$ mkdir -p ~/.ssh
2. 添加公钥
$ cd ~/.ssh
3. 添加公钥publickey
$ touch authorized_keys
$ cat ‘你的公钥字符串’ >> authorized_keys
设置公钥文件权限
$ chmod 700 .ssh
$ chmod 600 .ssh/authorized_keys
设置 SSH,打开密钥登录
$ sudo su
# vi /etc/ssh/sshd_config
##取消注释,无则增加
PubkeyAuthentication yes
RSAAuthentication yes
## 禁用root账号登录
PermitRootLogin no
## 禁用密码登录
PasswordAuthentication no
$ service sshd restart