- 创建新的用户名,密码
groupadd hscaleflux
useradd -g hscaleflux -n -d /home/hscaleflux -s /bin/bash hscaleflux
- 生成ssh密钥对
ssh-keygen -t rsa
- 将公钥复制到目标服务器
ssh-copy-id username@remote_host
或者
ssh-copy-id myserver
- 修改远程服务器配置文件
vim /etc/sudoers
添加一行: hscaleflux ALL=(ALL) NOPASSWD:ALL
- 免密登录测试
ssh username@remote_host