Permissions Flashcards
Set user id upon execution
> setuid
Set group ID
> setgid
so files are executed with the permissions of the group of the user who runs it. This is easier to manage.
Assign file permissions to file owner only
Sticky bit
If it is turned on only owner of file can delete the file. If off then anyone else can too.
> chmod
Adds or removes sticky bit
File pointers
1. Regular file
- Directory
- Symbolic link
- Read
- Write
- Execute
1, -
- d
- l
- r
- w
- e
Show what groups user is in
Change user group permissions
> groups [user]
> chmod + / - / = “r / w / x”
General Permissions concepts
Put files into directories that can be accessed by privileged groups
> Permissions must be set on both levels:
1. File permissions
2. Directory permissions
> Default permission of file are based on where it was created (directory)
Permissions
>File Mode
>Binary
>Octal
Octal File Mode Binary 0 --- 000 > no permissions 1 --x 001 2 -w- 010 3 -wx 011 4 r-- 100 5 r-x 101 6 rw- 110 7 rwx 111
Permission Type
>
- : file
d : directory
l : link
Group commands
> groupadd
group mod
groups [username] (shows groups the user is in)
User commands
> useradd [username] and >passwd [user password]
useradd -r [name of service account]
userdel
usermod
View Permissions
> ls -l
Switching users
sudo su [username]
Identifying the user you are logged in as
whoami
Permission File
Read (r) »_space;> Allows a file to be read.
Write (w) >»_space; Allows a file to modified.
Execute (x)»_space; Allows the execution of a
file.
Permissions Directory
Read (r)»_space;Allows file names in the
directory to be read.
Write (w)»_space;>Allows entries to be
modified within the
directory.
Execute (x)»_space;Allows access to contents
and metadata for entries.
Permission Categories
u»_space; User
g»_space; Group
o»_space; Other
a»_space; All
User Group Other
4 2 1
File permission for new files
Explain> mask
In computing, umask is a command that determines the settings of a mask that controls how file permissions are set for newly created files. … umask may also refer to a function that sets the mask, or it may refer to the mask itself, which is formally known as the file mode creation mask.
Setting umask
Sets the file creation mask to mode
umask [-S] [mode]
Use -S to for symbolic notation.
Common Umask Modes
022
002
077
007
special umask modes
○ setuid
○ setgid
○ sticky