Course Hero 1
Course Hero 1
groupmod To modify the setting (GID, group name, users) for an existing
group
This study source was downloaded by 100000826888969 from CourseHero.com on 02-09-2022 01:08:44 GMT -06:00
https://www.coursehero.com/file/113258132/Practical-3-Managing-Linux-Permissions-and-Ownershippdf/
AACS2284 OPERATING SYSTEMS (PRACTICAL)
e. Create a directory called “currentuser_dir” under /home/administrator with the mode “rw-r--r--”.
mkdir currentuser_dir
chmod a-x currentuser_dir
or
chmod 644 currentuser_dir
f. Create a file called “currentuser_file” with default mode inside currentuser_dir. Can you create the
file in the directory? If not, make necessary modification on the directory’s mode. Enter “Hallo
World.”
cat > currentuser_dir/currentuser_file
Permission Denied
chmod a +x currentuser_dir
cat > currentuser_dir/currentuser_file (CTRL + D to terminate)
h. In the current account, view newuser_file using “cat” command. What message did you get? Why?
cat/home/newuser/newuser_file
Permission Denied
Because the file does not give permission to other users to view its content
This study source was downloaded by 100000826888969 from CourseHero.com on 02-09-2022 01:08:44 GMT -06:00
https://www.coursehero.com/file/113258132/Practical-3-Managing-Linux-Permissions-and-Ownershippdf/
AACS2284 OPERATING SYSTEMS (PRACTICAL)
Q3 Change the following files, which currently have NO permission settings, to have the specified
permissions (use ls to check your result):
This study source was downloaded by 100000826888969 from CourseHero.com on 02-09-2022 01:08:44 GMT -06:00
https://www.coursehero.com/file/113258132/Practical-3-Managing-Linux-Permissions-and-Ownershippdf/
AACS2284 OPERATING SYSTEMS (PRACTICAL)
Action Command
A. Change to your home directory cd ~
B. Make a directory named “myfolder” mkdir myfolder
*** C. Allow group and others to be able to chmod go+rx .
read and execute on your home directory
(the access rights for home directory by
default is already readable and executable.
This question is just to show students the
purpose of dot (.))
*** D. Allow group and others to be able to chmod go+rx myfolder
read and execute on the myfolder directory
(the access rights for myfolder by default is
already readable and executable. This question
is just to test students in using chmod
command)
E. Verify the permissions on your home ls-l /home
directory and on myfolder (to view home directory access rights, we need to
view from home folder)
ls -l
(this for checking myfolder access right)
F. Use touch to create an empty file named touch myfolder/text1.txt
text1.txt and text2.txtinmyfolder directory touch myfolder/text2.txt
G. Allow group and others to be able to write chmod go+w myfolder
all files in the myfolder directory (this is to change myfolder access rights, optional
and can be ignored)
chmod go+w myfolder/*
(this is to check access rights of all files in
myfolder)
H. Verify the permissions on the file(s) in ls -l myfolder/*
myfolder directory
This study source was downloaded by 100000826888969 from CourseHero.com on 02-09-2022 01:08:44 GMT -06:00
https://www.coursehero.com/file/113258132/Practical-3-Managing-Linux-Permissions-and-Ownershippdf/
AACS2284 OPERATING SYSTEMS (PRACTICAL)
Q5.
1. To combine /etc/passwd with /etc/group and send the output into the file users_groups.txt
Answer: cat/etc/passwd /etc/group > user_groups.txt
4. Move and rename the /tmp/file2 file to ~/my_file2 by using a single command.
Answer: mv/tmp/file2 ~/my_file2
5. Using wildcards token, list all the files with filenames consists of exactly 4 letters and which start
with the letter “M”.
Answer: ls -M???
6. Find all files in the /home directory that have the word “AACS2284” as part of their filename.
Answer: find /home -name “AACS2284”
7. List all the directory names that exist under the /var directory
Answer: ls -d/var/*
9. Write a command to show the date and time using each of the following formats:
hh: 11mm: 24
Answer: date + “hh: %H mm: %M”
10. For the umask 272, what will the permissions on all new files and new directories be? Express
your answers in octal format.
Anwser: New files ____404____ and new directories____505____
This study source was downloaded by 100000826888969 from CourseHero.com on 02-09-2022 01:08:44 GMT -06:00
https://www.coursehero.com/file/113258132/Practical-3-Managing-Linux-Permissions-and-Ownershippdf/
AACS2284 OPERATING SYSTEMS (PRACTICAL)
Q6. The questions below are interrelated and therefore must be done in sequence.
1. Create a non-empty file called Myfile file under your cat > Myfile
default user directory. sudo useradd -m John
Create a new user called John
5. Deny all access to the “letters” directory by everyone chmod 700 dirA/letters
except the owner.
This study source was downloaded by 100000826888969 from CourseHero.com on 02-09-2022 01:08:44 GMT -06:00
https://www.coursehero.com/file/113258132/Practical-3-Managing-Linux-Permissions-and-Ownershippdf/
Powered by TCPDF (www.tcpdf.org)