sshd

开启sshd

systemctl   status   sshd.service                           查看sshd服务状态
systemctl   start     sshd.service                            开启sshd
systemctl   stop    sshd.service                             关闭sshd
ssh  用户名@ip -X(调用图形功能)

ssh  用户名@ip -X +需要查看的文件目录名称  w-f 命令看不到登录的状态

ssh-******  做钥匙

Enter file in which to save the key (/root/.ssh/id_rsa):[enter]      加密字符保存文件(建议用默认)

Created directory '/root/.ssh'.

Enter passphrase (empty for no passphrase):         [enter]        **密码,必须>4个字符


Enter same passphrase again:                [enter]                         确认密码

sshd

 id_rsa:私钥(钥匙)id_rsa.pub :公钥(锁)

给ip地址11配钥匙

sshd

ssh-copy-id -i /root/.ssh/id_rsa.pub [email protected]

ssh-copy-id                        添加key认证方式的工具
-i                                       指定加密key文件
/root/.ssh/id_rsa.pub         加密key的地址                                 
root                                   加密用户为root               
 ip                被加密主机ip

分发钥匙

scp  /root/.ssh/id_rsa [email protected]分发的ip:/root/.ssh

是否更改用户密码认证状态 yes

yes 

输入密码


限制用户登录

编辑vim /etc/ssh/config

passwordAuthentication 是否开启用户密码认证

sshd

PermitRootLogin yes|no  是否允许用户登录

sshd

Allowusers root 允许root用户登录

sshd

Denyuusers student 不允许student用户登录

systemctl restart sshd.serviec 更新不重启