+5 votes
106 views
a user under Linux

in Linux Create by (552k points)
reopened | 106 views

1 Answer

+3 votes
Best answer

Create a user for someone else
Set up a new user for a program
Create an account with an expiration date
Activate a user

Linux works on the basis of user accounts to manage different users. We'll show you how to create a new user..

image image

Like most modern operating systems, Linux can manage different user accounts. There are not only accounts for the actual users, but also some hidden accounts for programs. The different user accounts can have different rights. In general, the "useradd" command is used to create a new user.

In the following, we'll show you how to create users using console commands . Of course you can also create new accounts in the user interface . However, this is not uniformly regulated on all Linux distributions. The console commands should work with the usual Linux operating systems without any problems.

Create a user for someone else

If you want to set up an account for someone else , it makes sense if the user has access to his own directory. Depending on the standard configuration of the operating system, it is possible that such a home directory is not automatically created when a user is created. You can ensure that a home directory is created by using the following command: Instead of the wildcard , you must specify the username. Make sure that there is a small "m" in the command. If there is a capital "M", NO home directory will be created . Finally, you have to activate the new account .

sudo useradd -m <Benutzername>

<Benutzername>

image
Here you can see a console window with the corresponding command - this is how it should look for you.

Set up a new user for a program

Sometimes you have to create a user if you want to install a certain program. These special users usually do not need their own home directory . So to create a new account without such a directory, use the command Instead of the wildcard you have to enter the user name. Make sure that there is a capital "M" in the command. With a lower case "m" a home directory is set up . Finally, you have to activate the new account. Then the new user has already been created.

sudo useradd -M <Benutzername>

<Benutzername>

image
If you only want to set up a guest user, the command shown is sufficient.

Create an account with an expiration date

A temporary account can also be created. This means that the account can only be used for a certain period of time and will then be deleted . This is particularly useful if, for example, you want to provide a visitor with an account or hire a temporary employee. It's just as easy to create as the other account types. Use the command:

sudo useradd -e JAHR-MONAT-TAG <Benutzername>
Instead of the wildcard <Benutzername> , you must of course specify the user name.

For example, if you want to create the user "Guest" whose account will expire on July 20, 2018, the command must look like this:

sudo useradd -e 2018-07-20 Gast

Now the account only needs to be activated ..

image
You can easily create temporary users with this command.

Activate a user

After creating an account, the user still has to be activated. To achieve this, a password must be set for the user . This is done using the command Replace the user name for the placeholder. You will then be asked to set a password for the new account.

sudo passwd <Benutzername>

image
To complete the setup, all you need is a password for the created user.

by (3.5m points)

Related questions

+4 votes
1 answer
asked May 22, 2019 in Linux / Unix by backtothefuture (552k points) | 361 views
+5 votes
1 answer
asked May 5, 2023 in Linux/Unix by backtothefuture (552k points) | 65 views
+4 votes
1 answer
asked Apr 17, 2023 in Linux/Unix by backtothefuture (552k points) | 55 views
+3 votes
1 answer
asked Nov 4, 2019 in Linux / Unix by backtothefuture (552k points) | 267 views
+5 votes
1 answer
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users