如何在 Linux 桌面添加用户
用户

> 
> 无论是在安装过程中还是在桌面中，通过图形界面管理用户都非常容易。
> 
> 
> 


![](/data/attachment/album/201911/16/232237po6ntnrnj40jjtk4.jpg)


添加用户是你在一个新系统上要做的第一件事。而且，你通常需要在计算机的整个生命周期中管理用户。


我的关于 [useradd 命令](https://opensource.com/article/19/10/linux-useradd-command)文章提供了更深入的对 Linux 的用户管理的了解。`useradd` 是一个命令行工具，但是你也可以在 Linux 上以图形方式管理用户。这就是本文的主题。


### 在 Linux 安装过程中添加用户


大多数 Linux 发行版都提供了在安装过程中创建用户的步骤。例如，Fedora 30 安装程序 Anaconda 创建标准的 `root` 用户和另一个本地用户帐户。在安装过程中进入“配置”页面时，单击“用户设置”下的“用户创建”。


![Fedora Anaconda Installer - Add a user](/data/attachment/album/201911/16/232336uau0bmaggjngbmne.png "Fedora Anaconda Installer - Add a user")


在用户创建页面上，输入用户的详细信息：全名、用户名和密码。你还可以选择是否使用户成为管理员。


![Create a user during installation](/data/attachment/album/201911/16/232349lry0z80y1y4zqna1.png "Create a user during installation")


点击“高级”按钮打开“高级用户配置”页面。如果需要除默认设置以外的其他设置，那么可以在此处指定主目录的路径以及用户和组 ID。你也可以输入用户所属的其他组。


![Advanced user configuration](/data/attachment/album/201911/16/232412kq2ypbygqzytsstq.png "Advanced user configuration")


### 在 Linux 桌面上添加用户


#### GNOME


许多 Linux 发行版都使用 GNOME 桌面。以下截图来自 Red Hat Enterprise Linux 8.0，但是在其他发行版（如 Fedora、Ubuntu 或 Debian）中，该过程相似。


首先打开“设置”。然后打开“详细”，选择“用户”，单击“解锁”，然后输入密码（除非你已经以 root 用户登录）。这样将用“添加用户”按钮代替“解锁”按钮。


![GNOME user settings](/data/attachment/album/201911/16/232418ygjm2x1hxh3h318h.png "GNOME user settings")


现在，你可以通过单击“添加用户”，然后选择“帐户类型”然后输入“用户名”和“密码”来添加用户。


在下面的截图中，已经输入了用户名，设置保留为默认设置。我不必输入“用户名”，因为它是在我在“全名”字段中输入时自动创建的。如果你不喜欢自动补全，你仍然可以对其进行修改。


![GNOME settings - add user](/data/attachment/album/201911/16/232429v23c019992vvn0nz.png "GNOME settings - add user")


这将为名为 Sonny 的用户创建一个标准帐户。Sonny 首次登录时需要提供密码。


接下来，将显示用户。在此页面可以选择每个用户进行自定义或者删除。例如，你可能想选择一个头像或设置默认语言。


![GNOME new user](/data/attachment/album/201911/16/232445b49wfffvooffdo79.png "GNOME new user")


#### KDE


KDE 是另一个流行的 Linux 桌面环境。下面是 Fedora 30 上 KDE Plasma 的截图。你可以看到，在 KDE 中添加用户与在 GNOME 中添加用户非常相似。


![KDE settings - add user](/data/attachment/album/201911/16/232521vg5vv551nqvqcg5c.png "KDE settings - add user")


### 总结


除 GNOME 和 KDE 外，其他桌面环境和窗口管理器也有图形用户管理工具。无论是在安装时还是安装后，在 Linux 中以图形方式添加用户都是快速简便的。




---


via: <https://opensource.com/article/19/11/add-user-gui-linux>


作者：[Alan Formy-Duval](https://opensource.com/users/alanfdoss) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
Adding a user is one of the first things you do on a new computer system. And you often have to manage users throughout the computer's lifespan.

My article on the [ useradd command](https://opensource.com/article/19/10/linux-useradd-command) provides a deeper understanding of user management on Linux. Useradd is a command-line tool, but you can also manage users graphically on Linux. That's the topic of this article.

## Add a user during Linux installation

Most Linux distributions provide a step for creating a user during installation. For example, the Fedora 30 installer, Anaconda, creates the standard *root* user and one other local user account. When you reach the **Configuration** screen during installation, click **User Creation** under **User Settings**.

![Fedora Anaconda Installer - Add a user Fedora Anaconda Installer - Add a user](https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda2.png)

On the Create User screen, enter the user's details: **Full name**, **User name**, and **Password**. You can also choose whether to make the user an administrator.

![Create a user during installation Create a user during installation](https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda3.png)

The **Advanced** button opens the **Advanced User Configuration** screen. Here, you can specify the path to the home directory and the user and group IDs if you need something besides the default. You can also type a list of secondary groups that the user will be placed into.

![Advanced user configuration Advanced user configuration](https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda4.png)

## Add a user on the Linux desktop

### GNOME

Many Linux distributions use the GNOME desktop. The following screenshots are from Red Hat Enterprise Linux 8.0, but the process is similar in other distros like Fedora, Ubuntu, or Debian.

Start by opening **Settings**. Then go to **Details**, select **Users**, click **Unlock**, and enter your password (unless you are already logged in as root). This will replace the **Unlock** button with an **Add User** button.

![GNOME user settings GNOME user settings](https://opensource.com/sites/default/files/uploads/gnome_settings_user_unlock.png)

Now, you can add a user by clicking **Add User**,** **then selecting the account **Type** and the details **Name** and **Password**).

In the screenshot below, a user name has been entered, and settings are left as default. I did not have to enter the **Username**; it was created automatically as I typed in the **Full Name** field. You can still modify it though if the autocompletion is not to your liking.

![GNOME settings - add user GNOME settings - add user](https://opensource.com/sites/default/files/uploads/gnome_settings_adding_user.png)

This creates a standard account for a user named Sonny. Sonny will need to provide a password the first time he or she logs in.

Next, the users will be displayed. Each user can be selected and customized or removed from this screen. For instance, you might want to choose an avatar image or set the default language.

![GNOME new user GNOME new user](https://opensource.com/sites/default/files/uploads/gnome_settings_user_new.png)

### KDE

KDE is another popular Linux desktop environment. Below is a screenshot of KDE Plasma on Fedora 30. You can see that adding a user in KDE is quite similar to doing it in GNOME.

![KDE settings - add user KDE settings - add user](https://opensource.com/sites/default/files/uploads/kde_settings_adding_user.png)

## Conclusion


Other desktop environments and window managers in addition to GNOME and KDE include graphical user management tools. Adding a user graphically in Linux is quick and simple, whether you do it at installation or afterward.

## 7 Comments