Linux: Groups and users


Linux users are important to any linux distribution, without a user you wont be able to administer your linux server at all. In this article I will go through the basics of linux users, groups and permissions.

Create user

To create a new user you can run the command useradd  this command will create the most simple user. If you also want the newly created user to have their own home directory you can create the user in two different ways.

Either using useradd -d /home/ or by using the following command useradd -m . Using the first one will specify the exact path to the new users home directory and the second one will set the default path.

Once the user is created you can set the password for the user with the following command: passwd .

Deleting a user

The command userdel  can be used to delete a user from the system. If you wish to delete a specific user and its home directory (Including all files) you simply run this command: userdel -r .


To create a new group you can run groupadd.

If you want to check what groups a specific user are in you can run the groups  command. If you don’t add the username to the groups command you will see what groups the currently logged in user (you) are in.

To add a existing user to a group you can use the useradd command again but it will look like the following: useradd -a -G . This command will add an existing user to the specified group, if the group does not exist it will be created. The -a is there because we want to add a group to the user, without it we will replace the primary group of the user.

If you only want to create a new group, not adding it to a user you can run the following command: group add .

Deleting a group is simple, run the following command: groupdel .

Listing all users or groups

To list all users you must parse /etc/passwd, this can be done using the cat command: cat /etc/passwd

If you are looking for a specific user you can search for it using grep combined with cat. It will look like this: cat /etc/passwd | grep “username”. Keep in mind that by default grep is case sensitive, to turn this behaviour off you can use: grep -i “username”.

If you want to list all groups you can use the same commands, you only have to replace the path to: /etc/group to make it look like this: cat /etc/group | grep -i “username”.

Linux: Useful commands for daily use

Today I will go through a few useful tools that every Linux CLI (command-line interface) user will need. Listing files and directories, searching for files and directories, copy files and directories

A typical day of a web developer

Hi, my name is Jonathan, today I will tell you about a typical day of a web developer from my perspective.

Working as a Support Technician

Hello! My name is Emy and I work as a full-time support technician at a web bureau/web hosting company in southern Sweden. This article will give you.

Unity 5: Click to move with pathfinding

In this article I will show you one way to set up a simple click to move with pathfinding in Unity 5. We will setup an environment to test the pathfinding and write code required.