Linux Foundation One

Source: Internet
Author: User
Tags file permissions

1. Two ways to turn off SELinux
Setenforce 0
Modify the/etc/selinux/config file to set selinux=disabled, and then restart the server.
-----------------------------------------------------------------------------------------------------

2. The user is not in the Sudoers file and cannot use sudo
In the process of using the Linux system, we usually use ordinary users for daily operations, and the root user is only used in the rights assignment and system settings, and the root user's password is not possible to public. Normal user to the system program, need to temporarily elevate permissions, sudo is our common command, only need to enter the current user password, you can complete the temporary elevation of permissions. In the process of using the sudo command, we often encounter the current user is not in the sudoers file of the prompt information, if the problem is resolved? There are several steps that can be used to solve this problem very simply.
1. Switch to root user rights
Last Login:tue Sep-20:50:51 from 192.168.30.171
[[email protected] ~]$ su root
Password:
[Email protected] user]#
2, view/etc/sudoers file permissions, if read-only permission, modify as writable permission
[Email protected] user]# ls-l/etc/sudoers
-r--r-----. 1 root root 4030 September 00:57/etc/sudoers
[Email protected] user]# chmod 777/etc/sudoers
[Email protected] user]# ls-l/etc/sudoers
-rwxrwxrwx. 1 root root 4030 September 00:57/etc/sudoers
[Email protected] user]#
3, execute the VI command, edit the/etc/sudoers file, add the user to elevate the privileges; locate root all= (all) in the file, and add user information for elevated permissions under the row, such as:
Root all= (All) all
User all= (All) all
Description: The format is (the range of commands performed by the host in the user name network = (the target user executing the command)
4, save exit, and restore the/etc/sudoers access rights to 440
[Email protected] user]# chmod 440/etc/sudoers
[Email protected] user]# ls-l/etc/sudoers
-r--r-----. 1 root root 4030 September 00:57/etc/sudoers
[Email protected] user]#
5, switch to the normal user, test user rights promotion function
-----------------------------------------------------------------------------------------------------

Linux Foundation One

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.