Linux User Permission Management: Resolving Common Issues for Beginners
This article introduces the basics of Linux permission management and solutions to common problems for beginners. The permission system can be analogized to an apartment building: users (residents), groups (families), and files/directories (rooms). Permissions include read (r=4), write (w=2), and execute (x=1). Common problem solutions: 1. Password reset: For regular users, administrators use `passwd` to change passwords. To reset the root password, enter single-user mode (add `init=/bin/bash` to Grub under CentOS, then execute `passwd root`). 2. Insufficient sudo privileges: Switch to root with `su -`, then use `visudo` to add the user's permission line. 3. Permission format parsing: For example, `-rw-r--r--` (regular file, owner can read/write, group/others only read). Modify permissions using `chmod` (numerical method like `755`, symbolic method like `u+x`). 4. Directory access denied: Execute permission is required. Use `chmod +x` or `chown` to change the owner/group. 5. Create user groups: Use `useradd`/`adduser` and `groupadd`, then `usermod -g/-G` to assign groups. Security prompt: Principle of least privilege, `
Read More