Working with files and dirs Flashcards

1
Q

Set GID

A

mkdir -p /dir1/{finance,it}

chmod g+s /dir/it

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

getfacl

Supports only in xfs, ext4

A

getfacl /dir1

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

setfacl to user and group

A

setfacl -m u:it_user:rx /dir1

setfacl -m g:it:rx /dir1

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

Change max level of permissions assigned to mask in facl

A

setfacl -m m::rwx /dir1

setfacl -m m::- /dir1 -remove all privileges and set mask to —

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

Set default facl for user it_user

Remove default permissions

A
1. setfacl -d -m u:it_user:rw /dir1
so all files and dirs inside dir1 will have default privileges 
2. setfacl -m u:it_user:rwx /dir1
3. cd dir1
4. touch file1
5. getfacl file1=>
it_user will get default facl ie
rw-

setfacl -x /dir1 -remove default permissions

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

Remove facl permissions

Remove facl default permissions

A

setfacl -x u:it_user /dir1

setfacl -x d:u:it_user /dir1

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

Set facl to multiple users or groups

A

setfacl -m g:finance:rwX,u:it_user:rw /dir1

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

Copy facl from one file to another

A

getfacl file1 | setfacl –get-file=- file2

so –get-file=- (minus in this case means output from getfacl file1)

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

Allow group to traverse through dirs inside, but do not apply execute permissions to files inside the /dir1

A

chmod -R g+rwX /dir1

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

Which FSs support ACL

A

xfs, ext4

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

What mask sets on ACL

A

Sets max permission level even if DAC does not match and have less permission access

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

Change mask on ACL

A
permissions before: 777, mask=rwx
1. chmod 444 file1 => mask=r--
even ACL for a user=Bob is still = rwx
2. setfacl -m m::r file1 => mask=r--
even ACL for a user=Bob is still = rwx
Therefore, Bob will be able to read from file, but will not be able to write to or execute file1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Set mask=none on ACL

A

sefacl -m m::- file1
but when running later:
setfacl -m g:finance:rw file1
mask will change to mask=rw-

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

Set default ACL

A

ls -la => dir1 drwxr-xr-x
setfacl -d -m u:Bob:rw dir1
getfacl dir1 =>

user: :rwx
group: :r-x
other: :r-x
default: user::rwx
default: user:Bob:rw-
default: group::r-x
default: mask::rwx
default: other::r-x

Therefore user Bob will not be able to create files in dir1, since there are no regular permissions for Bob, there are only default.
we need to setfacl -m u:Bob:rwx dir1
and Bob will be able to create files in dir1

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

Remove default permissions on ACL

A

setfacl –remove-default dir1

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

Set execute permissions on dirs but not on files

A

chmod u+X dir1

setfacl -R -m g:finance:rwX dir1

17
Q

Remove all ACL entries

A

setfacl -b file1