1.在desktop主机中建立用户westos,并设定其密码为westoslinux
[[email protected] Desktop]# useradd westos ####创建用户westos######
[[email protected] Desktop]# passwd westos #####设置新密码#####
Changing password for user westos.
New password: ####输入密码#####
BAD PASSWORD: The password contains the user name in some form
Retype new password: #######再次输入######
passwd: all authentication tokens updated successfully. ####设置成功########
2.配置desktop中的sshd服务要求如下:
*)设定sshd服务只允许westos用户可以被访问使用
[[email protected] Desktop]# vim /etc/ssh/sshd_config ####打开ssh配置文件,设定访问限制
[[email protected] Desktop]# systemctl restart sshd.service ######!!!!!重启ssh服务刷新设置
*)创建westos用户的key认证方式
[[email protected] Desktop]# ssh-keygen ######生成公钥
[[email protected] Desktop]# ssh-copy-id -i /root/.ssh/id_rsa.pub [email protected] #####发送钥匙到主机
*)设定westos用户只允许使用key认证方式,屏蔽其系统密码认证方式
[[email protected] ~]# vim /etc/ssh/sshd_config ####修改内容如下
[[email protected] ~]# systemctl restart sshd.service