linux入门之sshd练习

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

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



第一问


第二问

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


进这个文件修改配置


修改79行,81行。



生成一对钥匙,锁


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

用公钥加密


[root@Nicholas .ssh]# ssh-copy-id -i /root/.ssh/id_rsa.pub westos@192.168.2.115

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
westos@192.168.2.115's password: 


Number of key(s) added: 1


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






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

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






  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值