For this part, I will share some security commands.
It is structured more as a reference sheet than a tutorial.
/etc/passwd (contains user (login) name, uid, etc...)
/etc/group (contains group account information)
/etc/shadow (contains passwords)
id display user identity
chmod change a file's mode
umask set the default file permissions
su Run a shell as another user
sudo execute a command as another user (lasts minutes)
chown change a file's owner
chgrp change a file's group ownership
passwd change a user's password
[user] to change password
Example: -rw-r--r-- 1 john john 0 Apr 30 14:32 foo.txt
- regular file
d directory
l symbolic link (with dummy values, real ones are those of original file)
c character special file (data as stream of bytes)
b block special file (data as blocks, like hard drive or dvd drive)
file mode
-rw- r-- r--
rwx = owner | rwx = group | rwx = world
r if file:
(read) allows a file to be opened and read
if directory:
allows a directory content to be listed if execute attribute
is also set
w if file:
(write) allows a file to be written or truncated
no rename, no delete
if directory:
allows files within directory to be created, deleted,
renamed if execute attribute is also set
x if file:
(execute) allows a file to be treated as a program
program files as scripting languages must be set as readable
to be executed
if directory:
allows a directory to be entered, e.g., cd directory
Files permission modes, as octal numbers.
0 000 ---
1 001 --x
2 010 -w-
3 011 -wx
4 100 r--
5 101 r-x
6 110 rw-
7 111 rwx
ex : chmod 600 foo.txt
= -rw-------
u user, means file or directory owner
g group owner
o others, means world
a all, u+g+o
(all by default.)
chmod u+s "program" assigning setuid
chmod g+s "dir" assigning setgid
use to make a shared directory (group)
chmod +t "dir" assigning the sticky bit
su [-[l]] [user] start a shell as another user
su -c '"command"' Use '', execute a single command as another user
sudo -l list sudo privileges
chown change owner and gr owner of a file or dir
chown [owner][:[group]] file...
Most of my studying of Linux was done using the book: The Linux Command Line by William Shotts, while daily driving Arch Linux.
I highly recommend the book for anyone wanting to learn Linux.