Howto manage user and groups: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
m (Protected "Howto manage user and groups" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
No edit summary
Line 24: Line 24:
to list all groups on our system:
to list all groups on our system:
  less /etc/group
  less /etc/group
= usermod =
to change the login shell of a user:
usermod -s /sbin/nologin username
Locking a user account:
usermod -L username
Unlock a user account:
usermod -U username
Add user to group:
usermod -aG groupname username
Modify username to expire at specific date:
usermod -L -e 2019-10-05 user03

Revision as of 21:37, 3 September 2021

creating users

add user and create home folder:

useradd -m student

specify user shell when creating the user:

useradd -m -s /bin/bash student

specify another location for user home folder:

useradd -m -d /opt/student student

specify default group name or group id:

useradd -m -g student 

specify userid:

useradd -m -u 1000 student

create user and add this user to different groups:

useradd -m -g student -G video,docker,sound,lp student

assign password to user:

passwd student

manage groups

add group:

groupadd vidalinux

add user to group:

gpasswd -a student vidalinux

add user to more than one group:

usermod -G wheel,video,sound,lp student

to list all groups on our system:

less /etc/group

usermod

to change the login shell of a user:

usermod -s /sbin/nologin username

Locking a user account:

usermod -L username

Unlock a user account:

usermod -U username

Add user to group:

usermod -aG groupname username

Modify username to expire at specific date:

usermod -L -e 2019-10-05 user03