User Tools

Site Tools


servermanagement:usermanagement

This is an old revision of the document!


Table of Contents

Usermanagement

To set up a user on a Linux server, there are a few steps you will need to follow. Here is a general guide for doing so:

1. Open a terminal session on the server. Connect to a Server via SSH

2. Run the command sudo adduser <username> to create a new user. You will be prompted to enter a password and other information such as the full name and email address.

3. Once the user has been created, run the command sudo usermod -aG sudo <username> to give the user sudo privileges. This allows the user to run commands as the root user.

4. Run the command su - <username> to log in as the new user.

5. The new user is now set up and can run commands on the server.

Note: This is a general guide and the exact steps may vary depending on the Linux distribution and server configuration. It is recommended to read the documentation of the distribution and tools being used to ensure that the user setup is performed correctly.

Commands

Here are more details on the commands used above, to give you more options on the different steps and more freedome in the way of you configuration.

adduser

The adduser command has a number of options that you can use to specify additional information or behavior when creating a new user. Here is a list of some of the most commonly used options:

all options need a double dash in front of them

  • system: This option specifies that the user being created is a system user, which means that the user will not be able to log in to the system.
  • shell: This option allows you to specify the shell that will be used as the default for the new user. By default, the /bin/bash shell is used, but you can specify a different shell if desired.
  • home: This option allows you to specify the home directory for the new user. By default, the home directory will be /home/<username>, but you can specify a different location if desired.
  • expiredate: This option allows you to specify an expiration date for the user's account. Once the specified date is reached, the user will no longer be able to log in to the system.
  • disabled-password: This option allows you to create a user account with a disabled password. This can be useful if you want to create a user account that can be used for certain tasks, but that cannot be used to log in to the system.

These are just a few examples of the options that are available with the adduser command.

For a complete list of options, you can run the man adduser command to get man page for a full documentation

servermanagement/usermanagement.1671786645.txt.gz · Last modified: 2022/12/23 10:10 by dimitrij

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki