liunx远程连接

本文详细描述了如何在Linux服务器上生成SSH密钥对,配置sshd服务以允许特定用户登录,并使用`ssh-copy-id`命令将公钥复制到另一台服务器,以便实现无密码访问。同时,文中还提及了激活Web控制台和注册RedHatInsights的过程。
摘要由CSDN通过智能技术生成

主机1:
hostname  server.example.com
vmset.sh 100
useradd -m timinglee
passwd timinglee 
timinglee 
主机2:
hostname client.example.com
vmset.sh 200
2.
[root@server200 .ssh]# ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:uheLti/lVNKwUJk9CFEPu1b1wWzAwGOWuPXsX/aRIWk root@server200.timinglee.org
The key's randomart image is:
+---[RSA 3072]----+
|      o=+B.+o+.  |
|      . *+X...+. |
|       ..Oo= .o  |
|        +oo oE . |
|        So .. . o|
|       o+   .  oo|
|      .= o   . oo|
|      +.+     . .|
|     .o=.        |
+----[SHA256]-----+
[root@server200 .ssh]# ls
id_rsa  id_rsa.pub  known_hosts  known_hosts.old
ssh -l root 172.25.254.100 -p22
[root@server100 桌面]# vim /etc/ssh/sshd_config
[root@server home]# vim /etc/ssh/sshd_config 
AllowUsers timinglee root
[root@server home]# systemctl restart sshd.service 
[root@server200 .ssh] ssh-copy-id  -i  id_rsa.pub root@172.25.254.100

测试
[root@client .ssh]# ssh -l root 172.25.254.100
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 17:03:54 2024 from 172.25.254.1
[root@server ~]#
[root@server ~]# exit
注销
Connection to 172.25.254.100 closed. 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值