UNIX File Permission help please answer the questions in the
UNIX File Permission help, please answer the questions in the green boxes. 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: us, 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 uic), 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@blue ne id uid 1234 (jmora) gid 1234 (jmora) groups 1234 mora) User account information is stored in the /etc/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? 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 2. Open the the apache account\'s uid and home directory? 3. Open the Vetc/group file. How many users are associated with the apache group?Solution
As per Chegg policy i can give you answers for first two green boxes.
Box 1 Answers:
1) use \"id\" command
syntax: id <username>
It will show your userid and to which groups this \"user id\" is associated with.
2) less /etc/passwd
after issuing this command, in the prompted screen give \"/<search_pattern>\" and type \"n\" . It will show you the matched pattern and take to the next match
3) open /etc/group using \"vi\".
vi /etc/group
now run the following command
:!cat %|grep -c \"pattern\"
Box 2 answers:
1)
$cd ~ //Change to your home directory
$umask 077
$cat >newfile
some text
^D
$ls -l newfile
-rw------- 1 naresh naresh 5 Feb 12 02:26 newfile
2)
numeral values of read(r)/write(w)/execute(x)
r=4
w=2
x=1
-rwx------- : chmod u=rw,g=0,o=0 <file/directory>
-r-x------: chmod 500 <file/directory>
-rwxr--r--: chmod u=rwx,g=r,o=r <file/directory>
-rwxrw----: chmod u=rwx,g=rw,o=0 <file/directory>
-r-xr--r-x: chmod 545 <file/directory>

