loading...

Linux Mint – Managing Users and Permissions

How to build a Docker Compose YAML files

We’ve explored quite a bit of Linux Mint, but our journey so far has only been with a single user account. You may or may not want other users to access your computer, but either way, it’s highly recommended to learn more about how users and permissions are handled in the Linux world to ensure that your bird’s-eye view of Linux functionality is complete. In this chapter, we’ll work through examples of user management (creating, disabling, and removing user accounts) as well as file and folder permissions. These concepts will be explored via GUI applications as well as shell command examples.

In this chapter, we will discuss the following topics:

  • Creating new users
  • Changing passwords
  • Temporarily revoking access
  • Removing user accounts
  • Adding and removing groups
  • Running commands or programs as other users
  • Administrative access via sudo and visudo
  • Understanding file and directory permissions
  • Modifying permissions

Creating new users

As with most things in Linux, there is more than one way to create user accounts in Linux Mint. Mint features a GUI tool to facilitate user management as well as shell commands that will help you get the job done. Although it’s much easier to use the graphical tools, which are very simplistic, it’s also important to learn how to manage users via shell commands, since your GUI may not always function and most Linux servers do not feature GUI applications. First, we’ll explore how to create users with Mint’s Users and Groups graphical tool, and then we’ll explore how to create users via shell commands. The following screenshot shows the Users and Groups tool, with the addition of some extra user accounts:

The Users and Groups tool is available in the Applications menu listed under the Administration section. Once you launch it, you’ll be able to create a new user account right away. To do so, simply click on Add and then a new window will appear, giving you a chance to fill out the necessary information to create the user account.

Note

The Users and Groups tool is available in the Cinnamon edition but may not be available in all Mint editions. For example, this tool is not featured in the Xfce edition. In regards to this edition, no GUI tool is included to manage users, so shell commands are the only way to go.

When creating the account, you’ll fill in fields such as Account Type, Full Name, and Username. The Username is what the user will actually type while logging in, while the Full Name is shown as the user’s name anywhere a name may be displayed, instead of a username. The following screenshot shows how to create a new user account in the
Users and Groups tool:

While creating a new user, the Account Type field is important. If a user is created with the Administrator option, then that user will be able to execute administrative commands on the system.

Note

Only give administrator access to those whom you trust. User accounts with administrative permissions are able to do more than just install software; they can remove packages, as well as delete files, regardless of the ownership. Specifically, this gives the user a sudo access, which is something we’ll cover later in this chapter.

Once you create a user account, note that no password is initially set. In order to assign a password to the account, click on the text next to Password (which initially reads No password set) and you’ll be prompted to create the password for the user. The following screenshot shows the dialog box in Users and Groups. This dialog appears when changing a user’s password.

In addition to setting the password, another concept of interest is Groups. Directly below the Password dropdown, there is a dropdown to add a user to one or more groups. If you click on it, a list of all the groups on the system will appear. You can add a user to any of the listed groups by checking the box next to it. If you set the user as Administrator, then the sudo group will already be selected for you. You can also create a new group. This will be discussed later in this chapter. The following screenshot shows how to choose groups in the Users and Groups tool:

So, what are groups? If you’re unfamiliar with the concept of groups, the idea is that you can simplify permissions greatly by adding users to a common group that has the permission to perform a particular task or access particular files. While we’ll discuss permissions in greater detail toward the end of this chapter, the basic summary is that files and folders can only be accessed by users who have permission to do so. If you want to give a user access to a directory or individual file, you can either modify the permissions of the file itself or add the user account to a group that has authority over it. The latter is much easier, as you can change who can access various resources by changing just one group membership rather than modifying the access on a file-by-file basis. To use the administrator access as an example, everyone who is a member of the sudo group has access to perform administrative tasks. If you no longer wish for a user to have administrative control, simply remove them from the group. Groups are very common in corporate IT environments, which rely on this concept quite heavily. This allows for things such as restricting access to a folder to only those groups whose job duties require it.

This is basically all there is in regard to user administration via Mint’s Users and Groups tool. The tool is very simplistic; it does not contain any advanced options. For example, if you would like to temporarily disable a user’s access to your machine, you won’t be able to do so via this tool. There’s no option included to suit this purpose, other than possibly changing a user’s password to something they don’t know. For advanced user management, you’ll need to utilize shell commands to do the job. As mentioned earlier, you may not always have access to a GUI, so shell commands are definitely useful.

In order to create a user in Mint via the terminal, the command you’ll use is the adduser command. In order to add a user, all you have to do is type sudo adduser followed by the username, as shown in the following statement:


sudo adduser jdoe

After you execute the adduser command, you’ll be walked through the setting of the default parameters for the user, such as their name as well as the password. However, you don’t have to answer every question. For example, you can skip adding the person’s first and last names as well as their phone number. To skip a field, simply press Enter without typing anything. However, the adduser command will not let you bypass without creating a password for the user; it will ask you over and over until you provide it. During the process, you may notice that the adduser command doesn’t prompt for the groups you would like the user to be a member of. For this, we’ll use a different command, which we’ll get to later.

For now, the takeaway is that the adduser command allows us to create a new user, and when you have finished entering in the values for the prompts, your new user account is ready to go. In the next section, we’ll discuss passwords.

Comments are closed.

loading...