Group & User management on Linux

About linux permission check this link.

A tool for converting numbers to RWX permissions.

Add new user
useradd <user>

Add user to group sudo
adduser YOURUSERNAME sudo
Change the primary group of a user
usermod -g nogroup Peter
Change the secondary group of a user
usermod -G nogroup Peter
Change Group ownership of a folders (and all subfolders)
chgrp -Rv USRGRP Media
View users of a group
getent group groupname
Change home of a user
usermod --home /var/www/ username
Create group
sudo addgroup groupname
Get primary group of a user
id -ng username
List all Users
cut -d: -f1 /etc/passwd

A user is not in the sudoers file

Solution 1:

Booting in recovery mode dropping into root console and

# mount -o rw,remount /

to get it writable

usermod -a -G sudo username

to get back a user into sudoers list

Solution 2:


ACL General Commands

Only for ACL type: NFSv4 ACL ENTRIES

Group & User Management

View users of a group:

getent group <groupname>
Example: getent group Managers

Add a user to a group

pw groupmod teamtwo -m db

Add permissions
User permissions to a file or folder
For example if you want a user (user1) to have write access to folderMedia, you can execute one of the following commands:

sudo setfacl -m u:user1:rwxcosW::allow MEDIA
sudo setfacl -m u:user1:rwxpDdacosW::allow /mnt/MEDIA
sudo setfacl -m u:user1:rwxpDda::allow /mnt/MEDIA

Set rights to a Group or to a folder:

setfacl -m g:USERS:rwxpDda::allow /mnt/MEDIA
find foldername/ -exec setfacl -m g:GROUPNAME:oprions::allow {} \;
find Music/ -exec setfacl -m g:AllUsers:rwxpDdacosW::allow {} \;
Full access: find Job/ -exec setfacl -m g:GRAMMATEIA:rwxpDdaARWcCos::allow {} \;
setfacl -x u:user1:rwxpDdacosW::allow /mnt/MEDIA
# file: MEDIA
# owner: <Owner>
# group: <Group of Owner>

Remove group <everyone>, : everyone@:rwxp–a-R-c–s:——:allow :

setfacl -x everyone@:rwxpDdacosW::allow /mnt/Share/Folder