LINUX: Basics
Upgrade and installation
sudo apt update
sudo apt upgrade -y
sudo apt install netcat
Directories
/usr or /home
/usr is where the user’s home directory is.
/usr/bin — This contains application that the user would install on the system.
/user/bin/strings — Where strings utility located. For more info on strings utility, please refer this link.
/etc/sudoers
This is where the sudoers
file is located. sudoers
file contains the rules that users must follow when using the sudo
command.
When using sudo
command, you can basically make the system to obey any commands that you write. Therefore, sometimes, it is really useful to use visudo
tto edit the sudoers file and give your account the root rights. This allows you to run commands as root without switching users.
/etc/passwd
This is a plain text-based database that contains information for all user accounts on the system.
It is owned by root and has 644 permissions. The file can only be modified by root or users with sudo privileges and readable by all system users.
Do note that in most Linux distributions, UID 1–500 are usually reserved for system users. In Ubuntu and Fedora, UID for new users start from 1000.
/etc/pam.d & /etc/security
Now, to authenticate to Linux system, we can either authenticate through:
- Password configured locally on the Linux system — /etc/passwd (authorization) and /etc/shadow (authentication for encrypted password)
OR
- Pluggable Authentication Modules (PAM)
If we have PAM enabled, we can authenticate through password configured on LDAP, Kerberos or applications.
PAM stores the configuration files for each application on /etc/pam.d and will execute the authentication activities based on the configuration.
Commands
- # — This indicates comment in the file, OS will ignore this line while executing.