Professional Documents
Culture Documents
Commands Linux
Commands Linux
1 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
4. Which command sets the sticky bit permission on the B. B is correct be-
/dir directory? cause the chmod
a. chown +t /dir command is used
b. chmod o+t /dir to set permissions.
c. chmod u+t /dir The letter "o" in
d. chmod g+t /dir o+t stands for
"others," which is
where the sticky
bit permission is
applied in the per-
mission set. The
"+" character adds
the permission,
and the "t" stands
for the sticky bit
permission.
5. You have been asked to find all the SUID files on the A. A is correct be-
system. Which of the following commands completes cause the -perm
this task? option is used to
a. find / -perm -6000 search for files by
b. find / -permission -6000 permission.
c. find / -mode -6000
d. find / -umask -6000
7. The user nick owns the file.txt file. He is a member D. A user can
of the payroll and sales group, with the payroll group change the group
being his primary group. He executes the following ownership of a file
2 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
command: owned by that user
chgrp sales file.txt to any group the
Which of the following statements is true? user is a member
a. This command fails because nobody but the root of.
user can change the group ownership of a file.
b. This command fails because a user can only change
the group ownership of a file to his primary group.
c. This command fails because the order of the argu-
ments is wrong.
d. This command works and changes the group owner
of the file to sales.
8. Permission trios
9. The first bit of the 10 shown is the type of object: .—Indicates that
this is a normal file
l—Indicates that
this is a symlink
(symbolic link),
which is a file that
points to another
object
b—Indicates that
this is a block de-
vice file
c—Indicates that
this is a character
device file
d—Indicates that
this is a directory
3 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
groups are this
group, but only if
that user is not the
user owner, this is
the permission trio
in effect.
14. The bit values equate to the following permissions for 4—Read, which is
files: the ability to view
the file's contents.
2—Write, which
is the ability to
change the file's
contents.
1—Execute; the
file can be execut-
ed. (The read is
also needed for a
script, but binaries
can execute with
only the execute
permission.)
15. These permissions have similar, but slightly different, 4—Read, which
meanings for directories: is the ability to
view the directo-
ry's contents (us-
4 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
ing the ls com-
mand). However,
to see file attribut-
es (such as with
the -l option to the
ls command), ex-
ecute permission
on the directory is
also required.
2—Write, which is
the ability to add
and delete files in
the directory. This
is a powerful per-
mission for direc-
tories as a user
can delete every
file in a directo-
ry, even files that
she doesn't own, if
she has the write
permission on the
directory. Caveat:
For write permis-
sion to be valid,
the user also must
have execute per-
mission.
1—Execute; the
user can use the
cd command to
get into the direc-
tory or use the di-
rectory in a path-
name. For exam-
ple, if the user at-
tempts to execute
cd /home/bob, the
user needs ex-
5 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
ecute permission
on the / directory,
the home directo-
ry, and the bob di-
rectory.
16. For example, say a user named fred is the user owner -rw-r-xr-x 2 fred
of the file object /home/fred/22AcaciaAvenue.mp3 and users 0 Jan 26
is also a member of the group owner of that object. 13:08 22 Acaci-
The file's listing has the following permissions set: aAvenue.mp3
6 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
18. numeric mode A method using
octal numbers for
setting object per-
missions. The two
modes of manipu-
lating the permis-
sions for an ob-
ject are numer-
ic and symbolic.
Both modes have
their place; the nu-
meric method is
better for chang-
ing all permissions
while the symbol-
ic method is bet-
ter for changing
one or two permis-
sions.
19. If you are told that the current permissions for an chmod 666 file1
object are 644 and you are asked to ensure that all
users have read and write access to that object The chmod com-
mand works great
on groups of files,
too:
chmod 644
/home/lukec/*.txt
20. Say the user bertrandr has a directory that he wants chmod -R 640
to set all the files to the permission of 640 to make the /home/bertran-
files more secure. dr/data/*
23. chomd -h
7 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
Changes symbolic
links, not the origi-
nal file
27. The symbolic mode uses a letter to identify the trios: User owner = u,
group owner = g,
other = o, and all =
a
A qualifier (+ to
add, - to remove,
or = to assign)
The permissions
being set (r = read,
w = write, and x =
execute)
28. Use the symbolic values to set permissions, you can chmod a=rwx file
change them all at once:
29. Change just the user owner's permissions to rwx chmod u=rwx
mystuff
31. Change the other or everyone else's permissions to r chmod o=r mystuff
32.
8 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
If you know a file exists but don't know the permis- chmod a+x file1
sions and you are told to make sure it's executable by
all permission trios Alternatively, you
can leave the "a"
off and get all the
trios by default:
chmod +x file1
9 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
the trio sets men-
tioned previously).
37. Special permissions can be set either of two ways numeric or sym-
bolic, just like set-
10 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
ting other per-
missions with the
chmod command.
39. Set both the SUID and SGID bits for the program chmod 6XXX
(which is somewhat rare, but permitted): /some/program
40. Second way to set special permissions is to use the chmod u+s
symbolic mode. For example, to add SUID on a file: /some/program
41. Set several special bits at once even with the symbolic chmod u+s,g+s
mode /some/program
43. If you do not want users to change their login shells chmod u-s
/usr/bin/chsh
46. Allow the wall program to have write access to the ls -l /dev/tty1
terminal device files group owned by the tty group:
47. Having problems with users abusing the wall com- chmod 0555
mand? Take away the SGID access: /usr/bin/wall
As the pre-
ceding command
changes the group
12 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
ownership to be
the projects group,
this means all new
files created in
the /home/project
directory are au-
tomatically group
owned by the
group owner of the
directory (which
would have to be
set to the project
group, of course).
The t in place
of the others ex-
ecute permission
indicates this is a
sticky bit directo-
ry. The /tmp direc-
tory is a location
where all users
must be able to
create files. Unfor-
tunately, the per-
mission that allows
users to create
files also allows
them to delete
files—all files—in
that directory.
50. Search for any object in the /usr/bin directory and find /usr/bin -perm
all subdirectories that has the exact permissions of 777
rwxrwxrwx
13 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
51. Search the entire system for all files that have the find / -perm -4000
SUID bit set, regardless of the other permissions.
52. Install the system and then run a find command that find / -perm -4000
reports any file that has an SUID bit set -ls
53. Run the same find command and then compare the diff
results to the original with the diff command /root/latestfind-
perm
/mnt/usb/find-
perm.orig
56. If you create a file when the umask is set to 022, the -rw-r--r-- 1 root
file's permissions is as follows: root 881 Feb 17
09:11 file1
14 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
57. If you create a directory with the same umask set, the drwxr-xr-x 2 root
directory's permissions are as follows: root 4096 Feb 17
14:47 dir1
59. Use the following chart and plug in different values for
your umask value for practice:
chown -options
user:group object
66. Say the user martha does expenses and needs to have chown martha:ac-
ownership of the file and you, as the administrator, counting snuffy-
want to change the group ownership of this file to the sexpenses.txt
accounting group. To accomplish this task
67. Let's say that now the file needs to be owned by chown fluchre
another user who cuts the checks, fluchre; you can snuffysexpens-
change just the user owner without having to bother es.txt
with the group owner:
68. If for some reason you decide that an entire directory chown -R root:ac-
tree of files needs to have its ownership changed, you counting /account-
can change them all ing
75. Consider the following output of the ls -l command: B. The user fred is
-rw-rwxr-x 2 fred users 0 Jan 26 13:08 22 test.mp3 the owner of the
Which of the following statements is true? file, so only the
a. The user fred has only read permission on test.mp3. owner permission
b. The user fred has only read and write permission on set (rw-) applies.
test.mp3. The "r" stands for
c. The user fred has read, write and execute permis- read and the "w"
sion on test.mp3. stands for write.
d. The user fred has no permission on test.mp3.
77. Which of the following commands sets the SUID per- A, D. Answers A
mission? (Choose two.) and D are correct.
a. chmod u+s file The SUID permis-
b. chmod g+s file sion can be set
c. chmod 2755 file symbolically by us-
d. chmod 4755 file ing u+s or nu-
merically by us-
ing 4XXX (with
XXX being regular
permissions). An-
swers B and C set
the SGID permis-
sion, not the SUID
permission.
18 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
normally rw-rwrw-,
so the resulting
new permissions
would be rw-------.
19 / 19