1. 创建新的用户名,密码

groupadd hscaleflux

useradd -g hscaleflux -n -d /home/hscaleflux -s /bin/bash hscaleflux

  1. 生成ssh密钥对

ssh-keygen -t rsa

  1. 将公钥复制到目标服务器

ssh-copy-id username@remote_host

或者

ssh-copy-id myserver

  1. 修改远程服务器配置文件

vim /etc/sudoers

添加一行: hscaleflux      ALL=(ALL)       NOPASSWD:ALL

  1. 免密登录测试

ssh username@remote_host