2011-04-27 67 views
1

我試圖爲名爲'invitado'的用戶設置權限,某些二進制文件的權限爲:wireshark,tcpdump和traceroute。使用visudo向linux用戶添加使用wireshark的權限

# /etc/sudoers 
# 
# This file MUST be edited with the 'visudo' command as root. 
# 
# See the man page for details on how to write a sudoers file. 
# 

Defaults env_reset 

# Host alias specification 

# User alias specification 

# Cmnd alias specification 

# User privilege specification 
root ALL=(ALL) ALL 
ldac ALL=(ALL) NOPASSWD: ALL 

# Allow members of group sudo to execute any command 
# (Note that later entries override this, so you might need to move 
# it further down) 
%sudo ALL=(ALL) ALL 
# 
#includedir /etc/sudoers.d 

#Permiso de SUDO a guest de wireshark 
invitado ALL=NOPASSWD : /usr/bin/aptitude/usr/bin/X11/wireshark 
invitado ALL=NOPASSWD : /usr/bin/wireshark 
invitado ALL=NOPASSWD : /usr/sbin/traceroute 
invitado ALL=NOPASSWD : /usr/sbin/tcpdump 

但是,我一直得到相同的visudo命令錯誤輸出:IV根據sudoers的語法我認爲這是下面做

>>> /etc/sudoers: syntax error near line 30 <<< 
What now? Options are: 
    (e)dit sudoers file again 
    e(x)it without saving changes to sudoers file 
    (Q)uit and save changes to sudoers file (DANGER!) 

任何建議???提前致謝!

回答

9

嘗試NOPASSWD後去除的空間。另外,你可以把所有的命令放在一行上。

invitado ALL = NOPASSWD: /usr/bin/aptitude, /usr/bin/X11/wireshark, /usr/bin/wireshark, /usr/sbin/traceroute, /usr/sbin/tcpdump 

編輯: 另外,我覺得/usr/bin/aptitude/usr/bin/X11/wireshark可能是錯誤的。這應該是2個命令,/usr/bin/aptitude/usr/bin/X11/wireshark

+0

你說得對,該行包含兩個命令。我試過評論資質(IM中給予了資質權限沒興趣),把所有的命令在一行,並得到了相同的信息:'>>>在/ etc/sudoers文件:近線語法錯誤28 <<< 什麼現在?' – Throoze 2011-04-27 19:37:33

+0

您是否在NOPASSWD(之前:)刪除了空格? – glomad 2011-04-27 19:43:51

+0

是的,沒有工作=( – Throoze 2011-04-27 19:49:40