Skip to content

Instantly share code, notes, and snippets.

@morteza-mori
Created July 3, 2017 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morteza-mori/9a480cae58a69535091678258cf15523 to your computer and use it in GitHub Desktop.
Save morteza-mori/9a480cae58a69535091678258cf15523 to your computer and use it in GitHub Desktop.
linux group & user
Users & Groups
Group file: /etc/group
Add User:
adduser USER
New Group:
groupadd GROUP
newgrp GROUP
Account numbering and important settings: /etc/login.defs
Own a user a folder:
chown -R USER FOLDER
Remove a user from a group:
deluser USER GROUP
Remove a user:
userdel -r USER
userdel USER → If you want to keep files and folders
Remove a group:
groupdel GROUP
Change a user’s group
sudo usermod -G GROUP -a 'USER'
Lock a user:
usermod -L USER
Or
Edit /etc/shadow and substitute the password with *
User information:
chage -l USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment