20180910 单用户与救援模式,虚拟机克隆,Linux机器相互登陆

单用户模式修改root密码

系统启动时,按方向上下任意键,而后选择第一项后按'e'键进入引导脚本进行编辑

而后找到linux16开头的行进行编辑,把ro改成rw init=/sysroot/bin/sh

改后,以下图,以后,按下ctrl + x 组合键进入到单用户模式了

切换当前目录到原系统环境,而后修改密码,执行touch /.autorelabel保证修改生效

修改完毕,重启以后登陆须要新密码才能登陆。linux

救援模式

首先,系统是出于关闭状态。对虚拟机要进行配置,保证系统是经过CD-ROM启动

设置完成后,启动系统,进入到BIOS,保证CD-ROM第一启动

保存退出后,再次进入系统,而后根据下面流程进行选择
centos

而后进入了救援模式

救援模式的密码更改

更改完成,取消设置服务器从光驱启动


修改完毕,重启以后登陆须要新密码才能登陆。服务器

虚拟机克隆

从菜单里找到克隆选项
dom

下一步到这里,选择建立连接(例图选择错误)
ssh

设置名称后克隆完成ide

两台Linux机器相互登陆

[root@centos0 ~]# ifconfig  # 查看当前机器的ip
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.77.129  netmask 255.255.255.0  broadcast 192.168.77.255
        inet6 fe80::20c:29ff:fe7c:eea3  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:7c:ee:a3  txqueuelen 1000  (Ethernet)
        RX packets 2528  bytes 300943 (293.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1143  bytes 159686 (155.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

# 登陆到192.168.77.131机器  
[root@centos0 ~]# ssh root@192.168.77.131 -p 22
root@192.168.77.131's password: # 输入192.168.77.131机器的root密码  


#用密钥对登陆

#生成密钥对
[root@centos01 ~]# 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:
4b:00:2f:2b:d1:2a:49:c8:fc:24:cf:36:be:d5:b1:55 root@centos01
The key's randomart image is:
+--[ RSA 2048]----+
|    .            |
|+  . o           |
|.=..o o    E     |
|..*o o .  .      |
|o o*.  .S.       |
| .o.. ..+.       |
|   . . o.        |
|    o            |
|   .             |
+-----------------+
# 把生成的 .ssh/id_rsa.pub 放到要登陆的服务器上
[root@centos01 ~]# ssh root@192.168.77.129 -p 22
Last login: Tue Sep 11 11:25:31 2018 from 192.168.77.131
# 直接登陆成功
相关文章
相关标签/搜索