linux - Warum muss ich immer noch ein Passwort eingeben, wenn NOPASSWD in sudoers konfiguriert ist?
某草草
某草草 2017-05-16 13:20:51
0
2
1237

Dies ist meine Sudoers-Konfigurationsdatei

Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification
Host_Alias TX=12x.xxx.xxx.xx9

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
www_remote TX=(root) NOPASSWD:/bin/chown

# 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

Nachdem Sie sich remote bei www_remote angemeldet haben, müssen Sie beim Ausführen von sudo chown noch das Passwort eingeben

[root@VM_xx_xx_centos ~]# sudo -u apache ssh xxx.xxx -l www_remote
Linux iZ...Z 3.2.0-4-amd64 #1 SMP Debian 3.2.86-1 x86_64

Welcome to aliyun Elastic Compute Service!

Last login: Sun May 14 17:55:32 2017 from 12x.xxx.xxx.xx9
www_remote@iZ...Z:~$ ls -l
总用量 0
-rw-r--r-- 1 www-data www_remote 0  5月 14 16:38 test
www_remote@iZ...Z:~$ sudo chown :www-data test 
[sudo] password for www_remote: 
www_remote 无权在 iZ281fkjotsZ 上运行 sudo。此事将被报告。

Wenn es www_remote ALL=(root) NOPASSWD:/bin/chown ist, kann der Befehl normal ausgeführt werden.

Was stimmt mit meiner Konfiguration nicht?

某草草
某草草

Antworte allen(2)
世界只因有你
sudo su root
Ty80

把"www_remote"那行挪到文件的最后,不然%sudo会把这条给覆盖掉。

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!