生成密钥
ssh-keygen -t rsa -f ~/.ssh/path/id_rsa
cat ~/.ssh/path/id_rsa.pub #为了下一步的复制做准备, 复制到authorized_keys中
复制密钥
useradd {name}
su {name}
cd
mkdir .ssh
chmod 700 .ssh
vim .ssh/authorized_keys
chmod 700 .ssh/authorized_keys
配置sshd文件
vim /etc/ssh/sshd_config
> Port 60237
> PasswordAuthentication no
> PermitRootLogin no
service sshd restart
配置ssh_config
Host {name}
user {username}
HostName 115.29.36.237
Port 60237
IdentityFile ~/.ssh/path/id_rsa