我使用的是 Backtrack 5 linux 发行版,我想安装 chrome,但默认情况下它不会以 root 身份运行。
我知道使用--user-data-dir会让我以 root 身份运行它。
但是有没有更安全的方法可以在这个 linux 发行版上使用 chrome 而不必以 root 身份运行它?
有没有办法在另一个用户的权限下(自动)执行 bash 脚本?我认为“sudo”是正确的方法,但我不知道如何自动化该过程。
例如,我想运行这样的程序(用户“bla”在“blub”下运行一个进程):
sudo <the user under which i want to run the process> <path to script>
Run Code Online (Sandbox Code Playgroud) 我已将以下几行添加到 /etc/sudoers.d/my_sudoers
Defaults mail_always
Defaults mailto="email@domain.com"
Run Code Online (Sandbox Code Playgroud)
每次sudo运行时我都会收到一封电子邮件
我该如何修改它,以便我只在特定人员运行 sudo 时收到电子邮件(除 2 个用户外的所有人)
谢谢
我有一个 MacOS X Mavericks 安装,该帐户只有一个用户管理员和空密码:

现在我正在尝试安装 Cocoapods,但不能使用“sudo”,因为我不知道root密码:
admin@mac:etc> id
uid=501(admin) gid=20(staff) groups=20(staff),401(com.apple.sharepoint.group.1),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),398(com.apple.access_screensharing),399(com.apple.access_ssh)
admin@mac:etc> id root
uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),3(sys),4(tty),5(operator),8(procview),9(procmod),12(everyone),20(staff),29(certusers),61(localaccounts),80(admin),401(com.apple.sharepoint.group.1),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),398(com.apple.access_screensharing),399(com.apple.access_ssh)
admin@mac:etc> sudo gem install cocoapods
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
Sorry, try again.
Password:
Sorry, try again.
Password:
Sorry, try …Run Code Online (Sandbox Code Playgroud) ssh使用默认的ec2-user. 我正在尝试列出默认 postgresql 目录的内容:
里面有什么?
$ ls /var/lib/pgsql9/
ls: cannot open directory /var/lib/pgsql9/: Permission denied
Run Code Online (Sandbox Code Playgroud)
好的。谁拥有这个?
$ ls -l /var/lib | grep pgsql
drwx------ 4 postgres postgres 4096 Jun 22 16:06 pgsql9
Run Code Online (Sandbox Code Playgroud)
啊。傻我。
$ sudo -u postgres ls /var/lib/pgsql9/
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes …Run Code Online (Sandbox Code Playgroud) 我尝试将GNOME软件包安装到 Ubuntu 14.04(unity)。我使用了这些代码。
sudo apt-get install gdm
须藤 apt-get 安装 gnome-shell
sudo apt-get 安装 ubuntu-gnome-desktop
须藤添加-apt-repository ppa:gnome3-team/gnome3-staging
sudo apt-get 更新
sudo apt-get dist-upgrade
sudo apt-get install gnome-weather gnome-music gnome-maps cheese gnome-documents
那做得不好,所以我完全删除了它们
sudo apt-get 删除 gdm
sudo apt-get 删除 gnome-shell
sudo apt-get 删除 ubuntu-gnome-desktop
现在我无法更改我的桌面壁纸。在桌面上单击鼠标右键不起作用。我认为它也删除了 Unity 的必要包。甚至登录屏幕显示也没有从 GNOME 风格更改为 Unity 风格。有没有办法恢复原来的Ubuntu统一风格?
sudo-1.8.15-2.fc23.x86_64fedora 23 中的软件包依赖于 vi,如以下证明:
$ rpm -qR sudo | grep vi
/usr/bin/vi
为什么?这是包维护者方面的错误吗?这种依赖性至少会导致fedora 23 中的一个错误。
我正在运行 Fedora 23,证明如下:
uname -a
Linux localhost.localdomain 4.2.3-300.fc23.x86_64 #1 SMP Mon Oct 5 15:42:54 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
我不太喜欢安装一些第三方 sudo 工具的想法,所以我决定使用 /etc/pam.d/sudo 技巧而不是使用 sudo-touchid ,它产生了奇迹。我将 iTerm2 与 zsh 一起使用,并且通过该设置它可以正常工作。但是当我使用 tmux(使用 reattach-to-user-namespace 默认命令)时,sudo 总是要求输入密码。有谁知道如何解决这个问题?
当我在 sudo 命令行提示符下输入密码时,它会显示*最近每次击键。这是新的默认行为吗?我如何再次关闭它?
pwfeedback我的/etc/sudoers文件中没有设置选项。我使用的是 Linux Mint 19,它基本上是 Ubuntu Bionic,sudo 的软件包版本是 1.8.21p2-3ubuntu1,我的 sudo 二进制文件显示的 sha256 哈希值与软件包中的相同。
感谢您的任何建议!
倒置问题:在 sudo 提示下输入密码时的反馈
我的 windows 机器没有密码,我不记得为 WSL 设置过密码。
当我尝试使用 时sudo,我被要求输入密码。由于上述原因,我不知道密码是什么。
为什么要我输入密码?
sudo ×10
linux ×6
ubuntu ×3
bash ×2
passwords ×2
amazon-ec2 ×1
backtrack ×1
command-line ×1
fedora ×1
gnome ×1
mac ×1
macos ×1
permissions ×1
privileges ×1
root ×1
script ×1
shell ×1
tmux ×1
vim ×1
windows-10 ×1