Friday 6 January 2012

Managing File Permissions and Ownership


·        List files which are readable for current user in /sbin directory
·        ls -l /sbin; find /sbin -perm -u=r -type f -exec ls -l {} \;

·        Create a file and change its permissions so that owner can only read the file and the respective group can read/write the file while other can read/write/execute the file using octal values
·        touch file; chmod 467 file;

·        Change the permissions of the file so that user can read/write/execute the file, group can read/execute the file and others can only read the file without using octal values
·        chmod u=rwx,g=rx,o=r test;

·        Create a new user “Lab_user” and change the ownership of the file to this new user
·        sudo useradd Lab_user; sudo chown Lab_user test; ls -l;

·        Create a new group “Lab_users” and assign this group to the file
·        sudo groupadd Lab_users; sudo chown :Lab_users test; ls -l;
·        sudo chgrp Lab_users test;

·        Change the default permissions to rwx rw- r--
·        umask 013;    (default is umask 022 )

·        Create directory so that only the owner or root can delete the directory
·        mkdir newdir; chmod go-w newdir;

·        Create a file so that when it is executed, the group ID of the process is changed to the group ID of the file
·        touch grp; chmod g+sx grp;

·        Create a new directory so that new files/directories created in this directory belongs to “Lab_users”
·        mkdir mydir; chmod g+sx mydir;

·        Create a file so that when the file is executed, the userID of the file changes to owner of the file
·        touch usrs; chmod u+sx usrs;

0 comments:

Post a Comment

 
Free Host | lasik surgery new york