Linux学习篇之~unit9练习

来源:互联网 发布:淘宝网之女款坡跟短靴 编辑:程序博客网 时间:2024/06/10 07:23

<<<第九单元练习>>>


1.在desktop主机中建立用户westos,并设定其密码为westoslinux

>命令行输入 useradd westos       ##添加westos用户

>命令行输入 passwd westos        ##设置westos密码


2.配置desktop中的sshd服务要求如下:

*)设定sshd服务只允许westos用户可以被访问使用

>命令行输入 vim /etc/ssh/sshd_config     ##更改配置文件

PermitRootLogin no

AllowUsers westos

>命令行输入 systemctl restart sshd.servce

>命令行输入 ssh westos@172.15.154.143 



*)创建westos用户的key认证方式

>在root命令下输入:ssh-keygen                                                      ##生成公钥、私钥

>ssh-copy-id -i /root/.ssh/id_rsa.pub westos@172.25.254.143     ##添加key认证



*)设定westos用户只允许使用key认证方式,屏蔽其系统密码认证方式

>命令行输入 vim /etc/ssh/sshd_config       ##更改配置文件

PasswordAuthentication no                        ##屏蔽密码登陆

>systemctl restart sshd.service                  ##重启sshd服务


>测试






<end>微笑微笑




0 0