美文网首页
is not in the sudoers file

is not in the sudoers file

作者: PApudding | 来源:发表于2018-09-08 22:26 被阅读0次

    问题:

    • 在初次使用sudo命令时(新用户),系统可能会提示
      “XXX is not in the sudoers file”

    万能百度:

    链接

    首需要切换到root身份
    $su -
    (注意有- ,这和su是不同的,在用命令"su"的时候只是切换到root,但没有把root的环境变量传过去,还是当前用户的环境变量,用"su -"命令将环境变量也一起带过去,就象和root登录一样)

    然后
    $visudo //切记,此处没有vi和sudo之间没有空格

    1、移动光标,到最后一行

    也不是一定在最后一行,我个人习惯将其添加到这行注释的下面
    “# User privilege specification”

    2、按a,进入append模式
    3、输入
    your_user_name ALL=(ALL) ALL
    4、按Esc
    5、输入“:w”(保存文件)
    6、输入“:q”(退出)
    这样就把自己加入了sudo组,可以使用sudo命令了。

    相关文章

      网友评论

          本文标题:is not in the sudoers file

          本文链接:https://www.haomeiwen.com/subject/cynlgftx.html