linux入门之sshd练习

1.在desktop主机中建立用户westos,并设定其密码为westoslinux
2.配置desktop中的sshd服务要求如下:
*)设定sshd服务只允许westos用户可以被访问使用
*)创建westos用户的key认证方式

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



第一问

linux入门之sshd练习_第1张图片

第二问

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

linux入门之sshd练习_第2张图片

进这个文件修改配置


修改79行,81行。

linux入门之sshd练习_第3张图片


生成一对钥匙,锁

linux入门之sshd练习_第4张图片

加密自己的主机(-i 指定加密key文件)

用公钥加密


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

The authenticity of host '192.168.2.115 (192.168.2.115)' can't be established.
ECDSA key fingerprint is f4:7b:49:a0:d0:c9:e0:27:07:49:9d:5c:24:78:c9:b3.
Are you sure you want to continue connecting (yes/no)? yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password: 


Number of key(s) added: 1


Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.






PasswordAuthentication no          ##有秘钥的话,可以不用输入密码

192.128.2.124可以不输入密码的情况下ssh链接我的主机






你可能感兴趣的:(linux入门之sshd练习)