0% found this document useful (0 votes)
31 views3 pages

Managing Permissions

The document discusses Linux file permissions and ownership. It covers changing ownership with chown and chgrp, managing basic permissions with chmod, understanding umask, special permissions like SUID and SGID, and access control lists (ACLs). Commands covered include ls, chown, chgrp, chmod, umask, and setfacl.

Uploaded by

pmmanick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

Managing Permissions

The document discusses Linux file permissions and ownership. It covers changing ownership with chown and chgrp, managing basic permissions with chmod, understanding umask, special permissions like SUID and SGID, and access control lists (ACLs). Commands covered include ls, chown, chgrp, chmod, umask, and setfacl.

Uploaded by

pmmanick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Understanding Ownership :-

Every file has a user-owner, group-owner, other entity granted permission

use ls -l to display current ownership and associated permissions

Changing File Ownership :-

use chown user[:group] file to set the user-ownership

chown anna newfile (change the owner from default user to anna)

chown anna:profs newfile (change the owner from deault user to anna
and change the group from default group to profs)

use chgrp group file to set group-ownership

chgrp students newfile

Understanding Basic permissions :-

File Directory

Read (4) Read List

Write (2) Modify Delete / Create

Execute (1) Run cd

Managing Basic Permissions :-

chmod is used to manage permissions

It can be used in absolute or relative path

chmod 750 myfile (absolute)

chmod +x myfile (relative)

u user (owner)
g group
o other (world)
a all (user, group, and other)

Operation
+ add
- remove
= set exactly
chmod a+rwx test_file

chmod g+x test_file

chmod u=rw,g=r,o=r test_file

chmod u-rwx test_file

Understanding umask :-

umask is a shell setting that subtracts the umask from the default
permissions

The default permission for a file is 666

The default permission for a directory is 777

umask

umask 027

umask value can be changed in profile as well

vim /etc/profile

cd /home/linda

ls -a

vim .bash_profile

Understanding Special Permissions :-

Files Directory

SUID (4) Run as Owner NA

SGID (2) Run as Group owner Inherit Directory Group owner

Sticky bit (1) NA Delete only if owner

SUID

chmod 4770 myfile

chmod u+s myfile

SGID
chmod 2770 mydir

chmod g+s mydir

mkdir -p /data/profs

chown :profs /data/profs

Sticky Bit

chmod 1770 mydir

chmod +t mydir

Understanding ACL :-

ACL are used to grant permissions to additional users and groups

The normal ACL applies to existing files only

Use a default ACL on a directory if you want it to apply to a new file

getfacl shows current settings

setfacl -R -m g:somegroup:rx /data/groups R->recursive m->modify


g->group rx->permissions

setfacl -m d:g:somegroup:rx /data/groups

+ symbol to be added after permission to indicate ACL is effective

Managing ACLs :-

groupadd account
groupadd sales
mkdir account
mkdir sales
ls -l
chgrp sales sales
chmod 770 sales
ls -l

setfacl -m d:g:account:rx sales

Troubleshooting Permissions :-

You might also like