解决shell命令"** is not in the sudoers file..."错误

Linux中新建的普通用户一般不会分配给root权限,每次都su root也太麻烦,可以通过在/etc/sudoers文件中添加当前用户的方式,给当前用户赋予sudo命令的使用权限。

# 切换到root用户
echo `whoami`" ALL=(ALL) ALL" >> /etc/sudoers

/etc/sudoers文件中配置的通用格式是:

user host=(run_as) command

其中,

user 用户名,需要添加的用户名

host 一个或多个主机名,一般写ALL

run_as 作为什么用户执行,通常是root或者ALL

command 允许以指定的用户执行的命令,可以是ALL或者指定的命令

* 网络搜索结果汇总而来,仅作备忘

时间: 2024-08-03 14:33:04

解决shell命令"** is not in the sudoers file..."错误的相关文章

adb shell命令后出现error: device not found错误提示

在cmd中输入adb shell进入linux shell环境前,需要把android模拟器打开(本文都是针对模拟器而言,并非真机).如果启动好了模拟器,且输入adb shell命令后出现error: device not found错误提示,则可以杀掉adb进程然后重新启动该进程,在cmd中输入如下命令: adb kill-server adb start-server 注意:这里着重注意,要想adb shell命令执行成功,必须要同时打开android模拟器. 这是执行成功后,以root权限

CentOS下解决”用户账户is not in the sudoers file“问题

如上图,在当前用户cent(我的用户名)下使用sudo命令时,提示"cent is not in the sudoers file. This incident will be reported. "问题. 出现此问题,主要是因为用户名cent尚未获取sudo权限,所以需要修改配置文件/etc/sudoers. 修改如下: 首先以root权限登陆,即输入语句:su -,该语句等同于su - root,注意空格. 接下来修改sudoers配置文件,即:visudo.若想查看visudo的

Linux有问必答:怎样解决“XXX is not in the sudoers file”错误

问题:我想在我的Linux系统上使用sudo来运行一些特权命令,然而当我试图这么做时,我却得到了"[我的用户名] is not in the sudoers file. This incident will be reported."的错误信息.我该怎么处理这种sudo错误呢? sudo是一个允许特定的用户组用另一个用户(典型的是root)的特权来运行一个命令.sudo有详细的日志功能,并且提供了对用户可通过sudo来运行哪些命令的细粒度控制. Sudo vs. Su su命令也提供了

Shell命令-文件及目录操作之file、md5sum

文件及目录操作 - file.md5sum 1. file:显示文件的类型 file命令的功能说明 用于辨识文件类型.通过 file 指令,我们得以辨识该文件的类型. file命令的语法格式 file [-bchiklLNnprsvz0] [--apple] [--mime-encoding] [--mime-type] [-e testname]file [-bcLvz][-f <名称文件>][-m <魔法数字文件>...][文件或目录...] file命令的选项说明 file

java执行shell命令,chmod 777 xxx,改变权限无效的解决办法。

在java程序中执行shell命令,改变文件的权限,可以在命令行中执行 chmod 777 <span style="font-family: Arial, Helvetica, sans-serif;">/data/misc/123.sh"</span> 来改变权限,但是在java代码中执行这个命令时使用 Runtime.getRuntime().exec("chmod 777 /data/misc/123.sh"): 无效,使用

java运行shell命令,chmod 777 xxx,改变权限无效的解决的方法。

在java程序中运行shell命令,改变文件的权限.能够在命令行中运行 chmod 777 <span style="font-family: Arial, Helvetica, sans-serif;">/data/misc/123.sh"</span> 来改变权限,可是在java代码中运行这个命令时使用 Runtime.getRuntime().exec("chmod 777 /data/misc/123.sh"): 无效,使用

jenkins执行shell命令提示找不到命令解决办法

用jenkins执行shell脚本,执行一条命令: #唤醒休眠手机 adb shell input keyevent 2 提示: [adb] $ /bin/sh -xe /Users/xxxxx/tools/apache-tomcat-8.5.30/temp/jenkins8525959692743554347.sh + adb shell input keyevent 26 /Users/xxxxx/tools/apache-tomcat-8.5.30/temp/jenkins85259596

centos添加和删除用户及 xxx is not in the sudoers file.This incident will be reported.的解决方法

1.添加用户,首先用adduser命令添加一个普通用户,命令如下: #adduser tommy //添加一个名为tommy的用户 #passwd tommy   //修改密码 Changing password for user tommy. New UNIX password:     //在这里输入新密码 Retype new UNIX password:  //再次输入新密码 passwd: all authentication tokens updated successfully.

xxx is not in sudoers file 解决(转)

解决方案:首需要切换到root身份$su -(注意有- ,这和su是不同的,在用命令"su"的时候只是切换到root,但没有把root的环境变量传过去,还是当前用户的环境变量,用"su -"命令将环境变量也一起带过去,就象和root登录一样) 然后$visudo     //切记,此处没有vi和sudo之间没有空格 1.移动光标,到最后一行2.按a,进入append模式3.输入your_user_name ALL=(ALL)  ALL4.按Esc5.输入“:wq”(