添加用户并加入到组
useradd ops
groupadd wheel
usermod -G wheel ops
passwd ops
如果没有wheel组,则创建
groupadd wheel
ssh-keygen
ssh-keygen -t rsa -b 4096 -C “ops@sunits.com”
ssh-copy-id -i ~/.ssh/id_rsa.pub -oPort=10022 ops@172.19.8.53
如果报错如下:
ssh-copy-id -i ~/.ssh/id_rsa.pub -oPort=22 ops@172.19.11.10
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/root/.ssh/id_rsa.pub”
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keys
ops@172.19.11.10’s password:
Could not chdir to home directory /home/ops: No such file or directory
则证明对面没有创建/home/ops文件夹
创建并赋权
mkdir /home/ops
chown ops:ops /home/ops
ssh-copy-id -i ~/.ssh/id_rsa.pub -oPort=10022 ops@172.19.7