#密码认证方式

#服务器端

vi /etc/ssh/sshd_config
PermitRootLogin yes
PermitEmptyPasswords no
PasswordAuthentication yes
systemctl restart sshd


#客户端

ssh root@lin25.example.local
ssh root@lin25.example.local "cat /etc/passwd"


#密钥认证方式

#服务器端

ssh-keygen -t rsa
cd ~/.ssh/
chmod 600 id_rsa.pub
mv id_rsa.pub authorized_keys
chmod 600 authorized_keys
scp id_rsa root@lin01.example.local:~/.ssh/id_rsa_$HOSTNAME


#客户端

ssh -i ~/.ssh/id_rsa_lin03.example.local root@lin03.example.local "shutdown -P"