How to modify user permissions in linux

Source: Internet
Author: User
We know that linux is generally a new user who does not have the permissions under his Directory. if you want to give him the permissions, you should give them the permissions based on the files or run the command chmod to change the permissions.

Generally, if we need to modify user permissions on a daily basis, we usually need to either modify the user's gorupid, which can be changed through the above Command; or change a common user to a user with super permissions, this cannot be changed directly. only root users or users with root permissions can help you modify it. in the/etc/passwd file, find the line corresponding to userid, change the userid column to 0, and then force save and exit. At this time, your user has the superuser permission. You can also change the user's groupid.

If you want to change the attributes of a file, it is relatively simple. you can directly use the chmod command. Generally, I am going to answer numbers directly. if you want to grant rwx permissions, you can give 7, rw-, is 6, r -- is 4 (binary, corresponds to x-1, W-2, r-4), for example, to give a file user rwx permissions, the permission of r-x in the user group. if r is read-only, you can use the chmod command:
# Chomd 754.

Modify permissions:

1) tools or commands used to manage users;
Useradd note: add a user
Adduser note: add a user
Passwd note: set a password for the user
Usermod note: to modify user commands, you can use usermod to modify the logon name and user's home directory;
Pwcov note: synchronize users from/etc/passwd to/etc/shadow
Pwck note: pwck verifies whether the content of the user configuration file/etc/passwd and/etc/shadow is legal or complete;
Pwunconv note: it is the vertical reverse operation of pwcov. it is to create/etc/passwd from/etc/shadow and/etc/passwd, and then delete the/etc/shadow file;
Finger note: Tools for viewing user information
Id note: view the UID, GID, and user group of the user.
Chfn note: change user information tool
Su note: User switching tool
Sudo note: sudo uses another user to execute commands (execute a command as another user), su is used to switch users, and then the user to complete the corresponding tasks through the switch, however, sudo can directly execute the following commands. for example, sudo can execute root authorization without the root password. only root can execute the corresponding commands; however, you must edit/etc/sudoers through mongodo;
Except do note: visodo is the command for editing/etc/sudoers. you can also use vi to edit/etc/sudoers;
Sudoedit note: similar to the sudo function.

If you modify the user's own permissions, 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 in UNIX systems are divided into three types: "user himself, usergroup, and other users", which can be "read, write, and execute". you can see these types in ls-la, for example:

# Ls-l
-Rwxr-xr-x 1 root bin 62528 Jan 23 2005 zip
R indicates read/read, w indicates write/write, and x indicates execute/execution.
Userid is generally unique, but you can modify the group information of your user to add the user group to access specific files.
Groupadd: add a user group;
Groupdel: delete a user group;
Groupmod: modify user group information

2) tools or commands used to manage user groups;
Groupadd note: add a user group;
Groupdel note: delete a user group;
Groupmod note: modify user group information
Groups note: displays the user group to which the user belongs.
Grpck
Note: Use the/etc/group and/etc/gshadow file content to synchronize or create/etc/gshadow. if/etc/gshadow does not exist, create it;
Grpunconv note: use the/etc/group and/etc/gshadow file content to synchronize or create/etc/group, and then delete the gshadow file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.