Linux/User Management: Difference between revisions

From Dev Wiki
Jump to navigation Jump to search
(Create page)
 
(Add commands to update user passwords)
Line 1: Line 1:
Commands to manage user accounts in linux.
Terminal commands to manage user accounts in linux.


== Creating a New User ==
== Creating a New User ==
Line 14: Line 14:
<code>useradd -G admins,webadmin,developers my_user</code><br>
<code>useradd -G admins,webadmin,developers my_user</code><br>
This creates a user called "my_user" that is associated with groups "admins", "webadmin", and "developers".
This creates a user called "my_user" that is associated with groups "admins", "webadmin", and "developers".
== Updating User Password ==
Update password for current account:
* <code>passwd</code>
Update password for another user account:
* <code>passwd <username></code>

Revision as of 02:16, 20 December 2019

Terminal commands to manage user accounts in linux.

Creating a New User

The most basic implementation is:

  • useradd <username>

From there, you can add argument options such as:

  • -M or --no-create-home - Skips creating a home directory for user.
  • -N or --no-user-group - Skips creating a group with the same name as user.
  • -G or --groups - Set additional user groups user is part of, during user creation.
  • -r or --system - Create a "system" account. Aka, a user with no password, no home directory, and is unable to log in.

Example:
useradd -G admins,webadmin,developers my_user
This creates a user called "my_user" that is associated with groups "admins", "webadmin", and "developers".


Updating User Password

Update password for current account:

  • passwd

Update password for another user account:

  • passwd <username>