You are on page 1of 19

Chapter 10.

Permissions and Ownership


Étudiez en ligne sur https://quizlet.com/_4ggd5r

1. Which command lets you alter the default permis- D. A is not


sions in a shell? correct as the
a. chmod chmod command
b. chgrp changes permis-
c. chown sion on an exist-
d. umask ing object. Answer
B is not correct
as the chgrp com-
mand changes
group ownership
of an existing ob-
ject. Answer C
is not correct as
the chown com-
mand changes
user and/or group
ownership of an
existing object.

2. Consider the following ls -l output: A. A is correct


What are the permissions for the user fred on the because the user
sample.mp3? fred is the own-
a. Read, write, and execute er of the file and
b. Read and execute the owner's per-
c. Read and write missions are rwx,
d. Only read which stands for
read, write, and
execute.

3. Which command adds execute permission to all per- C. C is correct


mission sets (owner, group, and others)? because the let-
a. chmod u+x file ter "a" in a+x
b. chmod u=x file stands for "all,"
c. chmod a+x file the "+" character
d. chmod g+x file adds the permis-
sion, and the "x"
stands for the exe-
cute permission.

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

6. Consider the following command chown bob:bin B, C. The chown


file.txt command can
Which of the following statements are true? (Choose change both user
two.) owner and group
a. This changes the user owner of file.txt to bin. owner. The user
b. This changes the user owner of file.txt to bob. owner is listed
c. This changes the group owner of file.txt to bin. first, followed by a
d. This changes the group owner of file.txt to bob. ":" character and
then the group
owner.

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

10. User owner If the user is the


user owner, this is
the permission trio
in effect

11. Group owner If the user's pri-


mary or secondary

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.

12. Other If the user is nei-


ther the user own-
er nor a member
of the group own-
er, this is the per-
mission trio in ef-
fect.

13. permission trios The permission


sets for the object
user owner, group
owner, and others.

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

The fred user's


permissions might
seem to span the
various trios, but
because fred is
the user owner,
he matches the
first trio and stops
there. In other
words, the user
fred has read and
write permission,
but not execute,
even though fred is
a member of the
users group and
members of that
group do have ex-
ecute permission
on this file.

17. chmod command is used when mod-


ifying or altering
an object's permis-
sion trio bits. Only
the root and ob-
ject's owner can
alter permissions.

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/*

21. chomd -c Reports only


which files were
changed

22. chomd -v Reports all files

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

24. chomd -f Suppresses error


messages

25. chomd -R Operates recur-


sively through di-
rectories

26. symbolic mode A method using


symbols for set-
ting object permis-
sions.

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

30. Change the group owner's permissions to r-x chmod g=rx


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

33. access control list In Linux permis-


sions, a system
that makes it pos-
sible to grant per-
missions to more
than one user
and more than
one group. Access
control lists also
allow administra-
tors to set de-
fault permissions
for specific directo-
ries.

34. SUID The Set User ID


(SUID) permission
allows users to run
a program as if
they were the user
owner of the pro-
gram; in most cas-
es the user own-
er is the root user.
The numeric val-
ue of this permis-
sion set is 4XXX
(where "XXX" is
replaced by the
numeric values for

9 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
the trio sets men-
tioned previously).

35. SGID When set on


a directory, the
Set Group ID
(SGID) permis-
sion automatically
gives group
ownership of all
new files created
in the directory to
the group owner of
the directory (nu-
meric = 2XXX).
When set on a
file, the SGID al-
lows users to run a
program as if they
were the group
owner of the file.

36. Sticky bit This permission


set is used to keep
"nonowners" from
deleting files in a
common directory
(numeric = 1XXX).
In a sticky bit direc-
tory, only the own-
er of the file or the
owner of the di-
rectory can delete
the file (root al-
ways can delete
files as well).

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.

38. Set the SUID permission on the file: chmod 4XXX


/some/program

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

42. As a regural user change login shell -rws--x-- 1 root


root 15432 Apr 29
2013 /usr/bin/chsh
The s in place
of the user own-
er's execute per-
mission indicates
this is an SUID
command. When
this command ex-
ecutes, it modi-
fies the contents
of the /etc/passwd
file. The /etc/pass-
wd file is not nor-
mally something
that can be mod-
ified by non-root
users;

43. If you do not want users to change their login shells chmod u-s
/usr/bin/chsh

44. Demonstration of SUID


11 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
ls -l /usr/bin/chsh
su - student
$ chsh
/bin/csh
exit
chmod u-s
/usr/bin/chsh
su - student
chsh
/bin/bash

45. wall command allows users to


send messages to
the terminal win-
dows of all users
logged in. Normal-
ly this would be
a security issue;
you don't want a
user to interfere
with another user's
terminal window.
Having a message
pop up in a termi-
nal where a user
is working can be
distracting

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

48. Add SGID permission to the /home/project directory chmod g+s


/home/project

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).

49. Ensure that users in a shared directory can't delete drwxrwxrwt 29


anyone else's files root 4096 Jun 2
17:27 /tmp

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

54. The default permissions with For files: rw-rw-rw-


no umask value set are (or 666)
For directories:
rwxrwxrwx (or
777)

55. View the umask for your current shell umask


0022

This just means


that of the four
possible positions
to mask out
(special permis-
sions, user own-
er permissions,
group owner per-
missions, and oth-
er permissions),
the last two have
the write permis-
sion masked out or
not used.

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

58. umask value changes the default permissions of a Maximum default


created object based on the following formula: value - umask val-
ue = create value

59. Use the following chart and plug in different values for
your umask value for practice:

60. chown command used to set the


user owner, group
owner, or a com-
bination of the
two with one com-
mand. The format
for the chown com-
mand is:

chown -options
user:group object

61. The chown command accepts both of the following chown


commands as valid snuffy:users file1
chown
snuffy.users file1

62. chown owner Changes only the


user owner

63. chown owner:group Changes both the


user owner and
group owner

64. chown owner: Changes the user


owner and sets the
group owner to the
primary group of
the current user
15 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r

65. chown :group Changes only the


group owner and
leaves the user
owner unaffected

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

69. chgrp command When just the


group owner
needs to be
changed. Syntax
of the command is
straightforward:

chgrp staff file1

70. chgrp -c Shows a line of


output only for
changed objects

71. chgrp -h Changes symbolic


links, not the origi-
nal file

72. chgrp -R Recursively af-


fects the target
and all children
16 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r

73. chgrp -v Shows a line of


output for every
object, regardless
of the actions per-
formed on the ob-
ject

74. The execute permission for directories provides what D. Answer A is


access? incorrect because
a. The ability to list file names in a directory this is the access
b. The ability to add files to the directory provided by the
c. The ability to remove files from the directory read permission.
d. The ability to change into the directory Answers B and C
are incorrect be-
cause these are
the access provid-
ed by the write per-
mission.

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.

76. Which of the following is the equivalent to the com- C. Answer C is


mand chmod 644 file.txt? correct because it
a. chmod a+r,ug+w file.txt sets all the permis-
b. chmod u+rw,g+r,o+r file.txt sions equal to 644.
c. chmod u=rw,go=r file.txt The other answers
d. chmod ugo+r,u+w file.txt only change some
permissions, so it
is possible that
the execute per-
mission could be
17 / 19
Chapter 10. Permissions and Ownership
Étudiez en ligne sur https://quizlet.com/_4ggd5r
still set for user
owner, group own-
er, or others, and
the write permis-
sions could still be
set for group own-
er and others.

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.

78. Consider the following command: B, C. Answers B


umask 077 and C are correct.
Assuming this command was executed in the current The umask 077
shell, which of the following are true? (Choose two.) command "masks
a. A new directory created in this shell would have the out" all permis-
permissions of rw-------. sions for group
b. A new directory created in this shell would have the and others. The
permissions of rwx------. maximum permis-
c. A new file created in this shell would have the sions of directories
permissions of rw-------. is normally rwxr-
d. A new file created in this shell would have the wxrwx, so the re-
permissions of rwx------. sulting new per-
missions would be
rwx------. The max-
imum permissions
of directories is

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

You might also like