adding permissions with visudo to a linux user for using wireshark

Throoze picture Throoze · Apr 27, 2011 · Viewed 22.3k times · Source

Im trying to set permissions for a user named 'invitado', jus for some binaries: wireshark, tcpdump and traceroute. Iv done according to the sudoers syntax which i think is the following:

# /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

However, i keep obtaining the same visudo error output:

>>> /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!)

Any suggestions??? thanks in advance!

Answer

glomad picture glomad · Apr 27, 2011

Try removing the spaces after NOPASSWD. Also, you can put all the commands on one line.

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

Edit: Also, I think /usr/bin/aptitude/usr/bin/X11/wireshark was probably wrong. That should be 2 commands, /usr/bin/aptitude and /usr/bin/X11/wireshark.