理解 login
命令
在这一步骤中,我们将探索 Linux 中的 login
命令,该命令用于登录系统。login
命令是系统管理员和用户访问其账户并执行各种任务的关键工具。
首先,让我们了解 login
命令的基本语法:
login [options] [username]
login
命令可以与多种选项一起使用,例如 -p
用于保留环境变量,-h
用于指定主机,以及 -f
用于强制登录而无需身份验证。
要以普通用户身份登录,只需输入 login
并在提示时输入用户名和密码:
$ login
Username: labex
Password:
示例输出:
Last login: Thu Apr 13 10:30:00 UTC 2023 on pts/0
Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-69-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This system has been minimized by removing packages and services to reduce
security risks and improve performance. If you need to restore functionality
please use the 'sudo apt-get install -y ubuntu-standard' command.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
labex@ubuntu:~/project$
输出显示用户 labex
已成功登录系统。