Linux Permissions and Ownership Flashcards

1
Q

**

Which command we use to change permissions of a file/directory?

A

chmod <permissions> <file or
directory name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the different types of permissions in Linux?

A

read, write and execute, setuid, setgid, sticky
bit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the numeric values that the system assigns for read, write, and execute?

A

read=4, write=2,
execute=1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are different ways to change the permissions of a file or directory?

A

permissions can be
changed symbolically using u, g, o, a, r, w, x. + to add permissions, - to take away permissions, = sets
the specified permissions.
numeric or octal and symbolic.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does chown -R do?

A

changes ownership recursively

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is meant by chmod 777?

A

user, group and
other have read, write and execute permissions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

If you want to allow different users to access a directory, how would you ensure that users would
not be able to delete each other’s files/directories?

A

set sticky bit on the directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can we configure a directory called "/Project," so all the files and directories created in it by
any user have their default group to be "admins"?

A

chgrp admin /Project then chmod g+s /Project

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can we ensure that the user owner of a directory has read, write and execute permissions,
while the group and others have only read and execute permission? Please ensure all the subdirectories/files retain the same permissions as well. (Provide exact syntax).

A

chmod -R 755
<directory name> or chmod -R u=rwx,go=rx <directory name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the purpose of umask?

A

command used to control the default permissions. user creation
mask

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the default umask value for the "root" user and for a regular user?

A

0022 for root
and 0002 for regular user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If the umask value for a regular user is set to 0023, what permission will be set on a file when this user creates one?

A

644 – rw-r—r—

(0023 - mask the write permission for group, mask the write and execute permission for others)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If the umask value for a regular user is set to 0044, what permission will be set on a directory when this user creates one?

A

733 -rwx-wx-wx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Umask, and how do you set it for individual users and/or system-wide?

A

for regular
user vi .bashrc and systemwide is vi /etc/bashrc

source .bashrc will read your .bashrc file without logging you out.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the 3 special permissions in Linux besides read, write, and execute?

A

set UID –
allows a file to be executed with the permissions of the file owner, set GID, Sticky bit – prevents
accidental deletion of files by other users.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which special permission helps prevent users from deleting each other’s files accidently in
a “collaborative” directory?

A

Sticky bit, chmod o+t or number 1

17
Q

How can you change file/directory ownership?

A

chown newowner <file or directory name>

18
Q

How to change the user owner of a file?

A

chown newowner <filename>

19
Q

How can we modify the group on the file called "/etc/test" to be "sybadm"?

A

chgrp sybadm
/etc/test

20
Q

What is the difference between chown and chmod commands?

A

chown is used to change
the user and group ownership of a file or directory

chmod is used to change the mode of
permissions for the user, group and others of a file or directory

21
Q

What is the importance of the chgrp command?

A

used to change group ownership of a file
or directory