- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 Terraform 在 Azure 上的 Linux VM 上安装 Jira Service Management。 Jira 的安装似乎工作正常,我现在正在尝试将 Jira 的证书附加到 Java key 存储。
我遇到的问题是当我启动虚拟机时,我似乎无法运行任何 sudo 命令。当我输入“sudo”时,出现此错误:
>>> /etc/sudoers: syntax error near line 123 <<<
>>> /etc/sudoers: syntax error near line 124 <<<
sudo: parse error in /etc/sudoers near line 123
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
我尝试编辑 sudoers 文件,但编辑器打开空白并显示我没有权限。我读过,我需要尝试运行“pkexec nano/etc/sudoers”,但随后它提示我输入 root 密码以作为 super 用户运行。我使用 Terraform 创建了虚拟机,但从未设置过密码,因此我不知道 root 密码是什么。我无法运行 visudo,因为它返回“visudo:/etc/sudoers:权限被拒绝”。
我可以做什么来获得 sudo 权限?在配置 VM 时,Azure 中是否需要执行某些操作,或者 Terraform 代码中是否存在可能影响 sudo 权限和功能的位置?
最佳答案
您遇到的错误是相同的问题,您可以尝试以下可能适合您的建议。
<强>1。重命名当前文件
mv /etc/sudoers{,.bak}
<强>2。创建一个新的vi/etc/sudoers,其基本内容如下:
/etc/sudoers # This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
rahul ALL=(ALL) NOPASSWD: /usr/bin/dockerd
3 .运行 visudo 并添加您的自定义内容。
您还可以尝试不同的 troubleshooting如果上述不起作用,请解决。
关于linux -/etc/sudoers 文件有问题但无法访问 root,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72369505/
一直按照编辑 sudoers 文件的说明进行更改,但说明说使用 ctrl+x 退出 - 这只是给了我一个大写的 X 和一个插入符号。试过 ctrl:x ctrl+Q Esc。 不使用 nano 或任何
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
这个问题在这里已经有了答案: sudo echo "something" >> /etc/privilegedFile doesn't work [duplicate] (15 个答案) 关闭 6
我在 sudoers 文件中添加了以下命令,但它给我语法错误,不允许在命令前使用“foo=bar”。 user ALL=(runas) SETENV:NOPASSWD:foo=bar /path/
这个问题已经有答案了: Linux: 'Username' is not in the sudoers file. This incident will be reported [closed] (1
我一直在尝试使用 devstack 在 centos 上安装 Openstack。当我运行脚本时,出现以下错误: [vagrant@centos64 devstack]$ ./stack.sh sud
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 10 年前。 Improve th
我正在尝试编写一个 sed 程序来在 /etc/sudoers 中的 Defaults requiretty 行之后附加 Defaults:user !requiretty 。我尝试了以下命令: su
我正在尝试编写一个 sed 程序来在 /etc/sudoers 中的 Defaults requiretty 行之后附加 Defaults:user !requiretty 。我尝试了以下命令: su
各位程序员, 我正在做我的学士项目,遇到了一点问题。 目标是创建一个 Web 应用程序,它可以操作和修改 WAGO PLC 750-8202(您可以将其想象成某种工业 Raspberry PI)的 I
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我有一个名为 ec2-user 的用户,通过这个用户,我可以借助能够连接到机器的 pem 文件连接到我的 EC2 实例, 现在我已通过此命令将此用户添加到 sudoers 列表中: echo 'ec2
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我正在尝试重新启动在 VM 中运行的 Linux 机器,并在 bash 脚本中调用以下命令: /usr/bin/sudo /sbin/shutdown -r 5 我已将以下内容添加到我的 sudoer
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
假设我们有这种情况: -rwxrwx-w- 1 user1 mygroup 0 Sep 12 16:53 testfile sudoer 可以更改此文件所有权吗?他必须是命令 chown 或文件上的
我需要通过 PHP 的 exec 函数从命令行运行 cPanel 脚本(其他 cPanel 选项不可行)。命令大致为: uapi --user=[user] Email suspend_incomin
我正在尝试在我的/etc/sudoers 文件 (redhat) 中添加“sudotest.sh”(或任何需要 sudo 的脚本/二进制文件)的 NOPASSWD 条目,但为了使其正常工作,我必须指定
我有四个用户: admin1_user admin2_user gen1_user gen2_user admin1_user 和 admin2_user 属于 USER_ALIAS admin。 g
我正在尝试运行一个自动调整屏幕背光的脚本,这需要它以提升的速度运行。 因此,我尝试将其添加到我的 sudoers 文件中,这样我就可以在没有脚本的情况下运行它。 不幸的是,我似乎无法让它发挥作用。 该
我是一名优秀的程序员,十分优秀!