第1章 简单使用 Linux

第1章 简单使用 Linux

1.1 Linux 的组成

1.2 远程连接

首先以 root 用户登录到 Linux 系统,然后在 Terminal 终端上输入 ip add 命令,来查看 IP 地址。

上图中的 192.168.72.128 就是 IP 地址。

然后打开 XShell 远程连接工具。

然后在命令提示符下输入 ssh root@192.168.72.128

注意:上面的 192.168.72.128 换为你们自己的 IP 地址。

 [D:\~]$ ssh root@192.168.72.128
 ​
 ​
 Connecting to 192.168.72.128:22...
 Connection established.
 To escape to local shell, press 'Ctrl+Alt+]'.
 ​
 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: Sun Oct 15 20:00:12 2023
 /usr/bin/xauth:  file /root/.Xauthority does not exist
 [root@bogon ~]# 

能够看到上面的内容表示远程连接成功。

重启系统命令:

 [root@bogon ~]# reboot   # 推荐使用
 ​
 [root@bogon ~]# init 6   # 此命令在新版本中不推荐使用了。

关机命令:

 [root@bogon ~]# poweroff   # 推荐使用
 ​
 [root@bogon ~]# init 0    # 此命令在新版本中不推荐使用

1.3 重置root密码

首先重新启动系统,然后快速按下 e 键进入如下界面:

然后再最后一行之前输入 rd.break,如下图所示:

输入好后,按 ctrl + x 来重启系统。

重启启动后,按任意键继续,然后在第一个命令提示符下输入 mount -o remount,rw /sysroot 输入好后回车,再输入 mount | grep sysroot 后回车。如下图所示

然后在命令提示符下输入如下命令:

 chroot  /sysroot/
 echo 123 | passwd --stdin root
 touch  /.autorelabel

如下图所示:

然后再后面的命令提示符下输入两次 exit 来退出。

然后系统会自动重新启动。启动好后输入 root 和 123 后就可以登录了。

1.4 在系统中修改密码

 [root@bogon ~]# passwd
 Changing password for user root.
 New password: 
 BAD PASSWORD: The password is shorter than 8 characters
 Retype new password: 
 passwd: all authentication tokens updated successfully.
 [root@bogon ~]# 
  • 24
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

璀云霄

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值