zoukankan      html  css  js  c++  java
  • 用户不在sudoers文件中的解决方法 .

      在使用Linux系统过程中,通常情况下,我们都会使用普通用户进行日常操作,而root用户只有在权限分配及系统设置时才会使用,而root用户的密码也不可能公开。普通用户执行到系统程序时,需要临时提升权限,sudo就是我们常用的命令,仅需要输入当前用户密码,便可以完成权限的临时提升。在使用sudo命令的过程中,我们经常会遇到当前用户不在sudoers文件中的提示信息,如果解决该问题呢?通过下面几个步骤,可以很简单的解决此问题。

        1、切换到root用户权限

    Last login: Tue Sep 24 20:50:51 2013 from 192.168.30.171
    [user@Compile ~]$ su root
    密码:
    [root@Compile user]#

        2、查看/etc/sudoers文件权限,如果只读权限,修改为可写权限

    [root@Compile user]# ls -l /etc/sudoers
    -r--r-----. 1 root root 4030 9月  25 00:57 /etc/sudoers
    [root@Compile user]# chmod 777 /etc/sudoers
    [root@Compile user]# ls -l /etc/sudoers
    -rwxrwxrwx. 1 root root 4030 9月  25 00:57 /etc/sudoers
    [root@Compile user]#

        3、执行vi命令,编辑/etc/sudoers文件,添加要提升权限的用户;在文件中找到root  ALL=(ALL) ALL,在该行下添加提升权限的用户信息,如:

    root    ALL=(ALL)       ALL
    user    ALL=(ALL)       ALL

    说明:格式为(用户名    网络中的主机=(执行命令的目标用户)    执行的命令范围)

        4、保存退出,并恢复/etc/sudoers的访问权限为440

    [root@Compile user]# chmod 440 /etc/sudoers
    [root@Compile user]# ls -l /etc/sudoers
    -r--r-----. 1 root root 4030 9月  25 00:57 /etc/sudoers
    [root@Compile user]#

        5、切换到普通用户,测试用户权限提升功能

  • 相关阅读:
    科技公司网站
    jquery 设置元素内容html(),text(),val()
    jquery 相关class属性的操作
    jquery attr()和prop()方法的使用
    检测移动设备横竖屏
    设定程序在某个特定时刻执行
    js设计模式-建造者模式
    css自定义字体完美解决方案example
    css透明属性
    css3多列example
  • 原文地址:https://www.cnblogs.com/lvdongjie/p/3782188.html
Copyright © 2011-2022 走看看