Ubuntu系统用root用户实现远程登录

目录

1.创建root密码,系统自带root用户 

2.输入密码 

3.切换到家目录

4.生成公钥root@chenxueqi:~# ssh-keygen -t rsa -b 4096​编辑##出现这个  公钥生成成功

5.做免密

6.修改上方报错

6.1修改密码

 6.2修改ssh配置文件

6.2.1匹配到下图 

​编辑6.2.2 去掉注释

6.3.1匹配到下图

6.3.2修改下图

6.3重启ssh服务

6.4验证


1.创建root密码,系统自带root用户 

chenxueqi@chenxueqi:~$ sudo passwd root

2.输入密码 

chenxueqi@chenxueqi:~$ su  root

Password:   ##输入密码

3.切换到家目录

root@chenxueqi:/home/chenxueqi# cd

4.生成公钥
root@chenxueqi:~# ssh-keygen -t rsa -b 4096
##出现这个  公钥生成成功

5.做免密

root@chenxueqi:~# ssh-copy-id root@192.168.1.132

下方报错 

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.1.132 (192.168.1.132)' can't be established.
ECDSA key fingerprint is SHA256:RZjWNBD8kILvrvMRh29EKG0JfZcktkHks4oTJMq21rA.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.1.132's password: 
Permission denied, please try again.
root@192.168.1.132's password: 
Permission denied, please try again.
root@192.168.1.132's password: 
 

6.修改上方报错

远程连接192.168.1.132服务器 

6.1修改密码

chenxueqi@waware:~$ passwd  root 

 6.2修改ssh配置文件

root@waware:~# vim /etc/ssh/sshd_config 

6.2.1匹配到下图 
6.2.2 去掉注释

6.3.1匹配到下图

6.3.2修改下图

然后保存

6.3重启ssh服务

root@waware:~# systemctl restart  sshd

6.4验证

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值