Linux Permissions & Users
Understanding Linux permissions is crucial for security and system administration.User Management
File Permissions
Sudo and Root Access
Next: Linux Process Management →
Master Linux file permissions and user management
# View current user
whoami
# View all users
cat /etc/passwd
# Add user
sudo adduser username
# Delete user
sudo deluser username
# Switch user
su - username
sudo su # Switch to root
# Permission format: rwxrwxrwx
# Owner | Group | Others
# r=read(4), w=write(2), x=execute(1)
# Change permissions
chmod 755 file.txt # rwxr-xr-x
chmod u+x script.sh # Add execute for owner
chmod g-w file.txt # Remove write for group
# Change ownership
chown user:group file.txt
chown -R user:group directory/
# View permissions
ls -l
# Run command as root
sudo command
# Edit sudoers file
sudo visudo
# Become root
sudo su
sudo -i