UNIX File Permission help, please answer the questions in the 3rd and 4th green
ID: 3792166 • Letter: U
Question
UNIX File Permission help, please answer the questions in the 3rd and 4th green box (permissions in practice box and symlinks box). Thank you
Lab 03 File Permissions In this lab we will: learn about file permissions learn to create symbolic links and hard links Utilities that will be utilized in this Lab ls, cd less, cat, touch, chmod, id umask, mkdir, In, echo and redirection. Users and Groups Linux supports several methods of controlling access to files an directories. In this lab we are going to learn the traditional access control model that is based on the concepts of file ownership and permissions. In this model, access is granted based on the concepts of users and groups. A user is an individual access account, and they can belong to one or more groups, and they can own files. When user accounts are created, they are assigned a username and a user id (or uid), and also a primary group which defaults to the same as the user id To find out your uid and the groups that your account is associated with, use the id command: j mora Oblue m]$ id uid-1234 (jmora) gid 1234 (jmo ra) groups-1234 (jmora) User account information is stored in the Vetc/passwd file. Each line on this file corresponds to a user record, which contains 7 fields separated by a colon username: the name used to login into the system. It should be between 1 to 32 charcters long password: a value of x indicates the account has an encrypted password stored in /etc/shadow user ID (UID): user identification number. By default UID 0 is reserved for root user and UID's ranging from 1-99 are reserved for other predefined accounts. Further UID's ranging from 100-999 are reserved for system accounts and groups. group ID (GID): primary group ID. user info: This field is optional and allow you to define extra information about the user. Tipically contains the account's full name. home directory: The absolute path of the user's home directory. shell: The absolute path of the user's default shell. Users and Groups 1. What is your user id? To which groups is your account associated? 2. Open the /etc/passwd file with the command less /etc/password, and locate the apache account (Hint: use the search feature of less to find your account). What are the apache account's uid and home directory? 3. Open the /etc/group file. How many users are associated with the apache group?Explanation / Answer
1.
Create Directory - mkdir lab03
Give execute access to directory - chmod 001 lab03/
sudo -s
cd lab03/
mkdir dir1 dir2 dir3 dir4
1. What command do you need to execute so you and no one else can run the torvalds.sh script
** chmod 110 torvalds.sh
2. What command do you need to execute so you can run dir1/matz.sh script
** chmod 777 dir1/matz.sh
** To run the file - sh matz.sh
3.What commands do you need to execute so other users can run the dir2/vanrossum.sh script.
** chmod o+rwx vanrossum.sh
4.What commands do you need to execute so others user can execute but not modify the script within dir4
** chmod 101 dir4/
** chmod o+x stallman.sh
5.What commands do you need to execute so you can execute the scripts within dir3, and the other users cannot list content of dir3 and can read the contents of the files contained within without being able to modify those files, and only the file called gosling.sh can be executed by others
**chmod o+wx dir3/
Symlinks :
Q.1.
echo "Lorem ipsum dolor sit amet consectetur" > dir1/lorem.txt
cd dir1/
cat lorem.txt
ln -s lorem.txt symlorem.txt
ls -l
permissions for symlorem.txt - lrwxrwxrwx (all permissions read,write,execute)
Q.2
chmod u-rwxx symlorem.txt
This will change the permission for lorem.txt and symlorem.txt will remain same.permission for lorem.txt ----r--r--
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.