PentOpsVault @syztem4our666

PentOpsVault
Linux

Users and Groups

Linux

Create group

groupadd [name]

Create group (alternative)

addgroup [name]

Delete group

groupdel [name]

Rename group

groupmod -n [newGroupname] [oldGroupname]

Create user

useradd [name]

Create user (alternative)

adduser [name]

Delete user

userdel [name]

Delete user (alternative)

deluser [name]

Rename user

usermod -l [newUsername] [oldUsername]

Set user password

passwd [name]

Grant sudo privileges to an existing user

usermod -a -G sudo [user]

Grant sudo privileges to an existing user (alternative)

adduser [user] sudo

User information

finger [user]

Add existing user to group

usermod -aG [groupName] [userName]

Add existing user to group (alternative)

adduser [userName] [groupName]

Add existing user to group (another alternative)

gpasswd -a [userName] [groupName]

Add new user to group

useradd -G [group] [user]

Remove user from group

gpasswd -d [user] [group]

Remove user from group (alternative)

deluser [user] [group]

List all groups

getent group

List all groups (alternative)

cat /etc/group

List all users

getent passwd

List all users (alternative)

cat /etc/passwd

On this page

Edit on GitHub