第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 ~]# 

相关推荐

  1. 1 开始

    2024-02-03 09:32:04       45 阅读
  2. Linux

    2024-02-03 09:32:04       28 阅读
  3. Linux

    2024-02-03 09:32:04       30 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-03 09:32:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-03 09:32:04       101 阅读
  3. 在Django里面运行非项目文件

    2024-02-03 09:32:04       82 阅读
  4. Python语言-面向对象

    2024-02-03 09:32:04       91 阅读

热门阅读

  1. JVM学习

    JVM学习

    2024-02-03 09:32:04      52 阅读
  2. MySQL之DQL正则表达式

    2024-02-03 09:32:04       52 阅读
  3. 数据库指定某个列的某个值优先排序

    2024-02-03 09:32:04       60 阅读
  4. H5调用安卓原生相机API案例

    2024-02-03 09:32:04       51 阅读
  5. 【设计模式之装饰器模式 -- C++】

    2024-02-03 09:32:04       53 阅读
  6. 前端工程化之:webpack1-12(常用扩展)

    2024-02-03 09:32:04       58 阅读
  7. 【Redis】理论基础 - 持久化

    2024-02-03 09:32:04       48 阅读