远程连接服务实战

[root@server100 ~]# hostnamectl hostname server.example.com
[root@server100 ~]# useradd timinglee
[root@server100 ~]# echo timinglee | passwd --stdin timinglee 

[root@client200 ~]# hostnamectl hostname client.example.com

2、[root@server100 ~]# vim /etc/ssh/ssh_config
Port 2222
[root@server100 ~]# systemctl restart sshd
[root@server100 ~]# netstat  -antlupe  |  grep  sshd
tcp        0      0  0.0.0.0:2222            0.0.0.0:*               LISTEN      0          23872      9
[root@server100 ~]# vim /etc/ssh/sshd_config
PermitRootLogin yes
AllowUsers  timinglee root
PasswordAuthentication yes
[root@server100 ~]# systemctl restart sshd

[root@client200 ~]# ssh-keygen -f /root/.ssh/id_rsa -P ""
[root@client200 ~]# cd /root/.ssh
[root@client200 .ssh]# ls
         id_rsa  id_rsa.pub  known_hosts  known_hosts.old
[root@client200 .ssh]# ssh-copy-id -i  id_rsa.pub root@172.25.254.100

测试:
[root@client200 .ssh]# ssh -l root 172.25.254.100  -p 2222
Activate the web console with: systemctl enable --now cockpit.socket
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Sat Apr 20 22:33:06 2024 from 172.25.254.200
[root@client200 ~]# 
[root@client200 ~]# ssh -l timinglee 172.25.254.100  -p 2222
         timinglee@172.25.254.100's password: 
         Permission denied, please try again.
         timinglee@172.25.254.100's password: 
         Register this system with Red Hat Insights: insights-client --register
         Create an account or view all your systems at https://red.ht/insights-dashboard
         Last failed login: Sat Apr 20 22:52:10 CST 2024 from 172.25.254.200 on ssh:notty
        There were 4 failed login attempts since the last successful login.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值