Ubuntu 中的 sudo 不断向我询问每个命令的密码。以前,我只需要输入一次密码,然后就会记住一段时间。这最近发生了变化,可能是在“升级”到 Natty 之后。
我已经完成sudo visudo
并设置Defaults env_reset, timestamp_timeout = 60
,尝试重新启动,但它仍然无法正常工作。我该如何解决?
经过以下建议,我/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:endolith timestamp_timeout=60
# Host alias specification
# User alias specification
# Cmnd alias specification …
Run Code Online (Sandbox Code Playgroud) 我正在使用 Ubuntu 10.04 Server 并尝试设置 sudoers 以尊重用户的 EDITOR 选择(在限制范围内)
在我的 sudoers 中,我有:
Defaults editor=/usr/bin/nano:/usr/bin/vim
Defaults env_reset
Run Code Online (Sandbox Code Playgroud)
在用户 .bashrc 中:
export EDITOR=/usr/bin/vim
Run Code Online (Sandbox Code Playgroud)
$EDITOR 设置:
$ echo $EDITOR
/usr/bin/vim
Run Code Online (Sandbox Code Playgroud)
根据man sudoers
这应该足以将 $EDITOR 设置为 vim:
editor A colon (':') separated list of editors allowed to be used with visudo.
visudo will choose the editor that matches the user's EDITOR environment
variable if possible, or the first editor in the list that exists and is
executable. The default is the path to …
Run Code Online (Sandbox Code Playgroud) 尝试这样做sudo apt-get update
,每次运行时都会得到此响应:
Get:1 http://repo.radeon.com/rocm/apt/debian xenial InRelease [1814 B]
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Err:1 http://repo.radeon.com/rocm/apt/debian xenial InRelease
Couldn't create temporary file /tmp/apt.conf.RpjjUo for passing config to apt-key
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Couldn't create temporary file /tmp/apt.conf.IvhgJr for passing config to apt-key
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Err:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Couldn't create temporary file /tmp/apt.conf.F98B6M for passing config to apt-key
Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Err:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Couldn't create temporary file /tmp/apt.conf.WWtE1d …
Run Code Online (Sandbox Code Playgroud) 我的计算机上安装了 Windows 10。我安装了 Oracle VirtualBox 并使用 Ubuntu 20.04 创建了一台机器。我需要这台计算机的管理权限,但由于某种原因,我无法拥有它们。我读过 Ubuntu 自动创建一个充当管理员的 root 帐户,并且您需要在命令之前使用“sudo”才能以管理员权限运行它。它要求我输入密码,我输入密码,然后系统告诉我我的帐户不是 sudoers,因此将报告该操作。我已经尝试过不同的教程来创建 sudoer 帐户,但它们都要求您已经在使用一个帐户。那么,如何将自己的帐户更改为 sudoers 帐户呢?或者,我如何从零开始创建一个具有这种管理员权限的新 sudoers 帐户(在 Virtual Box 中)?
我正在按照此站点上的说明进行 Grails 安装,但无法像它指示的那样写入 /etc/profile。
sudo echo ‘JAVA_HOME=/usr/lib/jvm/java-6-sun’ >> /etc/profile
Run Code Online (Sandbox Code Playgroud)
相反,我收到此错误:
bash: /etc/profile: Permission denied
Run Code Online (Sandbox Code Playgroud)
为什么即使使用 sudo 我也无法写入文件?
我如何让 sudo Ubuntu 10.04 会话在一小时而不是几分钟?
现在我必须每隔几分钟为 sudo 命令写下我的密码。
我将 ubuntu 加载到 virtualbox 中。一切正常,但我突然想到我没有被要求(或没有设置)root 密码。我有时想使用 root,但我似乎不知道如何做到这一点。我试图访问 sudoers 文件并运行 visudo 但没有 root 权限就没有权限!
任何想法如何获取或设置 root 密码?
我在 /etc/passwd 中有一个 root 用户。我拥有的两个帐户甚至没有权限管理组,因为它要求输入 root 密码而我不知道!
每个 ALL 是什么意思?我知道整行都表明 admin 组成员获得了 admininstartive 权限,但想了解有关 ALLS 位置的更多信息,以及他们是否各自引用不同的权限集或类似的内容?
$sudo cat /etc/sudoers
...
# User privilege Information
root ALL=(ALL) ALL
#...
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
#Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
#
Run Code Online (Sandbox Code Playgroud)
如果重要:操作系统:Ubuntu:10.4
我有一个 sshfs FUSE 文件系统安装在~/mountpoint
. 我试过umount mountpoint
和diskutil unmount mountpoint
(在 Mac 上),但都失败了。我用过sshfs -o IdentityFile=<key> user@hostname:/home/<user> ~/mountpoint
; 这些都不需要sudo。
那么,为什么要卸载它,我需要 sudo 权限吗?
Sudo root 权限是针对特定时间授予的,但仅限于一个终端。如果我想在那个时间段内在另一个终端中使用 sudo,我必须再次输入密码。如何强制 sudo 跨终端工作?
sudo ×10
ubuntu ×6
linux ×4
root ×2
sudoers ×2
ubuntu-10.04 ×2
virtualbox ×2
apt-get ×1
bash ×1
filesystems ×1
fish ×1
fuse ×1
passwords ×1
permissions ×1
profile ×1
session ×1
shell ×1
sshfs ×1
ubuntu-11.04 ×1
umount ×1
unix ×1
updates ×1
windows ×1