1) 创建用户user :
useradd -d /home/user -m
2) 在user根目录创建.ssh目录并设置读取权限 :
mkdir ~/.ssh
chmod 700 ~/.ssh
3) 创建基于SSH协议的RSA秘钥:
cd ~/.ssh
ssh-keygen -t rsa
4) 用user登录,将公钥添加到authorized_keys
cd ~/.ssh
cat id_rsa.pub > authorized_keys
chmod 600 auhtorized_keys
scp authorized.keys {node}:/home/user/.ssh/authorized_keys
网友评论