User Tools

Site Tools


servermanagement:usermanagement

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
servermanagement:usermanagement [2022/12/23 10:10] dimitrijservermanagement:usermanagement [2022/12/23 10:44] (current) – [usermod] dimitrij
Line 3: Line 3:
 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: 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. [[ssh_connection|Connect to a Server via SSH]]+1. Open a terminal session on the server. [[ssh|Connect to a Server via SSH]]
  
-2. Run the command ''sudo [[adduser|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.+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|usermod]] -aG sudo <username>'' to give the user sudo privileges. This allows the user to run commands as the root user.+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. 4. Run the command ''su - <username>'' to log in as the new user.
Line 18: Line 18:
  
 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. 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 ==== ==== adduser ====
Line 38: Line 39:
  
 For a complete list of options, you can run the ''man adduser'' command to get man page for a full documentation For a complete list of options, you can run the ''man adduser'' command to get man page for a full documentation
 +
 +==== usermod ====
 +
 +The usermod command is used to modify user accounts in Linux. It is typically used to change user account attributes, such as the user's login name, password, or group membership. Here is an overview of some of the most useful options for the usermod command, along with their syntax:
 +
 +  * ''-l, --login NEW_LOGIN'': This option allows you to change the user's login name. The syntax for using this option is ''usermod -l NEW_LOGIN OLD_LOGIN''
 +
 +  * ''-p, --password PASSWORD'': This option allows you to set or change the user's password. The password should be provided in an encrypted format. The syntax for using this option is ''usermod -p ENCRYPTED_PASSWORD USERNAME''
 +
 +  * ''-u, --uid UID'': This option allows you to change the user's UID (user ID). The syntax for using this option is ''usermod -u UID USERNAME''
 +
 +  * ''-g, --gid GROUP'': This option allows you to change the user's primary group. The group can be specified by name or by GID (group ID). The syntax for using this option is ''usermod -g GROUP USERNAME''
 +
 +  * ''-G, --groups GROUP_LIST'': This option allows you to specify a list of supplementary groups that the user should belong to. The groups can be specified by name or by GID. The syntax for using this option is ''usermod -G GROUP_LIST USERNAME''
 +
 +  * ''-d, --home HOME_DIR'': This option allows you to change the user's home directory. The syntax for using this option is ''usermod -d HOME_DIR USERNAME''
 +
 +  * ''-m, --move-home'': This option allows you to move the user's home directory to the new location specified with the -d option. The syntax for using this option is ''usermod -d NEW_HOME_DIR -m USERNAME''
 +
 +I hope this information is helpful! Let me know if you have any questions or need further clarification on any of the options.
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