# Users, Permissions and Groups
# Users
Command |
Action |
adduser |
Create a new user |
cat /etc/passwd |
View all users on the system |
cat /etc/passwd | grep {name} |
search for user |
chsh -s /path/to/shell |
Change default shell for a user |
id |
View user details |
passwd |
Change your own password |
passwd |
Change user password |
su - |
Switch to another user |
userdel -r |
Delete a user and their home directory |
usermod -aG sudo |
Add user to sudo group |
usermod -l <new_username> <old_username> |
Change username |
visudo (Add: ALL=(ALL:ALL) ALL) |
Grant sudo privileges to a user |
whoami |
View current username |
# Groups
Command |
Action |
grep '^sudo:' /etc/group |
Display members of the sudo group |
groups |
View groups a user belongs to |
# Permissions
Command |
Action |
chgrp new_group file |
Change group |
chmod ### file |
Change permissions |
chown -R new_owner:new_group dir |
Change owner and group |
chown new_owner dir |
Change owner |
groups forge
If forge is listed in the sudo group, then it has sudo privileges. The output might look something like this:
forge : forge sudo www-data