How to Modify User Permissions under Linux Training Tutorial





  Generally, when we encounter the need to modify user permissions on a daily basis, we often either modify the user's gorupid, which can be changed through the above command; or change the ordinary user to a user with super permissions, which generally cannot be changed directly, only root Or users with root privileges can help you to change. In the /etc/passwd file, find the line corresponding to the userid, change your id in the userid column to 0, and then force the save and exit. At this point your user has superuser privileges. You can also change the user's groupid like this.

  If you want to change the attributes of a file, it is relatively simple. You can use the chmod command directly. I usually follow the number directly. If you want to give rwx permission, give 7, rw-, that is 6, r-- is 4 (binary, corresponding to x -1, w-2, r -4), for example, to give a file user rwx permission, rx permission in the user group, and r--read-only for others, then use the chmod command to Yes, the following brothers will use linux training to analyze:

  # chomd 754 <finename>

  Modify permissions:

  1) Tools or commands for managing users (user);

  useradd Note: Add user

  adduser Note: Add user

  passwd Note: Set password for user

  usermod Note: To modify user commands, you can use usermod to modify the login name, the user's home directory, etc.;

  pwcov Note: Synchronize users from /etc/passwd to /etc/shadow

  pwck Note: pwck is to verify the user configuration files /etc/passwd and / Whether the content of etc/shadow file is legal or complete;

  pwunconv Note: It is the reverse operation of pwcov. It creates /etc/passwd from /etc/shadow and /etc/passwd, and then deletes the /etc/shadow file;

  finger Note: View user information tool

  id Note: View user UID , GID and the user group

  chfn to which it belongs Note: Change user information tool

  su Note: User switching tool

  sudo Note: sudo is to execute a command as another user, su is used to switch users, and then Complete the corresponding tasks by switching to the user, but sudo can directly execute commands later. For example, sudo can execute root assignments without the root password. Only root can execute the corresponding commands; but you have to edit /etc/ through visudo sudoers to achieve;

  visudo Note: visodo is a command to edit /etc/sudoers; you can also use vi to edit /etc/sudoers without this command, the effect is the same;

  sudoedit Note: The function is similar to sudo.

  Generally, if you modify the permissions of the user itself, there is not much to change. Generally, after a user creates a user (useradd), the user will have a default or specified userid and groupid. Generally, files under UNIX systems are divided into "Userself, usergroup, other users" can be "read, write, and execute" three categories, which can be seen with ls -la, such as:

  # ls -l

  -rwxr-xr-x 1 root bin 62528 Jan 23 2005 zip

  Among them, r means that it can be read/read, w means that it can be written/written, and x means that it can be executed/executed.

  Userid is generally unique, but you can modify your user's group information to join the required user group to access specific files.

  groupadd: add user group;

  groupdel: delete user group;

  groupmod: modify user group information   2

  ) Tools or commands to manage user groups;

  groupadd note: add user group;

  groupdel note: delete user group;

Group information

  groups Note: Display the user group to which the user belongs

  grpck

  grpconv Note: Synchronize or create /etc/gshadow through the file contents of /etc/group and /etc/gshadow, and create if /etc/gshadow does not exist;

  grpunconv Note: Synchronize or create /etc/group from /etc/group and /etc/gshadow file contents, then delete the gshadow file.

  Generally, when we encounter the need to modify user permissions on a daily basis, we often either modify the user's gorupid, which can be changed through the above command; or change the ordinary user to a user with super permissions, which generally cannot be changed directly, only root Or users with root privileges can help you to change. In the /etc/passwd file, find the line corresponding to the userid, change your id in the userid column to 0, and then force the save and exit. At this point your user has superuser privileges. You can also change the user's groupid like this.

  If you want to change the attributes of a file, it is relatively simple. You can use the chmod command directly. I usually follow the number directly. If you want to give rwx permission, give 7, rw-, that is 6, r-- is 4 (binary, corresponding to x -1, w-2, r -4), for example, to give a file user rwx permission, rx permission in the user group, and r--read-only for others, then use the chmod command to Can:

  # chomd 754 <finename>

  Modify permissions:

  1) Tools or commands for managing users (user);

  useradd Note: Add user

  adduser Note: Add user

  passwd Note: Set password for user

  usermod Note: Modify user commands through usermod To modify the login name, the user's home directory, etc.;

  pwcov Note: Synchronize users from /etc/passwd to /etc/shadow

  pwck Note: pwck is to verify whether the content of the user configuration files /etc/passwd and /etc/shadow files is legal Or complete;

  pwunconv Note: It is the reverse operation of pwcov, which creates /etc/passwd from /etc/shadow and /etc/passwd, and then deletes the /etc/shadow file;

  finger Note: View user information tool

  id Note: View User's UID, GID and user group

  chfn to which he belongs Note: Change user information tool

  su Note: User switch tool

  sudo Note: sudo is to execute a command as another user, su is used to switch users, and then complete the corresponding tasks through the switched user, but sudo can directly execute commands later, such as sudo You can execute the execution of root assignment without root password; only root can execute the corresponding command; but you have to edit /etc/sudoers through visudo;

  visudo Note: visodo is the command to edit /etc/sudoers; you can also do without this command, the effect of editing /etc/sudoers directly with vi is the same;

  sudoedit Note: The function is similar to sudo.

  Generally, if you modify the permissions of the user itself, there is not much to change. Generally, after a user creates a user (useradd), the user will have a default or specified userid and groupid. Generally, files under UNIX systems are divided into "Userself, usergroup, other users" can be "read, write, and execute" three categories, which can be seen with ls -la, such as:

  # ls -l

  -rwxr-xr-x 1 root bin 62528 Jan 23 2005 zip

  where r It means that it can be read/read, w means that it can be written/written, and x means that it can be executed/executed.

  Userid is generally unique, but you can modify your user's group information to join the required user group to access specific files.

  groupadd: add user group;

  groupdel: delete user group;

  groupmod: modify user group information

  2) Tools or commands to manage user groups;

  groupadd Note: Add user group;

  groupdel Note: Delete user group;

  groupmod Note: Modify user group information

  groups Note: Display the user group

  grpck

  grpconv the user belongs to Create /etc/gshadow, or create /etc/gshadow if it doesn't exist;

  grpunconv Note: Synchronize or create /etc/group from /etc/group and /etc/gshadow file contents, then delete gshadow file.



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326470477&siteId=291194637