3

I found an article http://superuser.com/questions/611511/how-to-launch-sshuttle-without-superuser-pwd-prompt, but when I try ps auxwww |grep sud, I get different output:

root      2846  0.0  0.1  79104  4328 pts/0    S+   08:27   0:00 sudo -p [local sudo] Password:  PYTHONPATH=/usr/lib/python3/dist-packages -- /usr/bin/python3 /usr/bin/sshuttle --method auto --firewall

So I tried to replace

/usr/bin/python /usr/share/sshuttle/main.py /usr/bin/python -v --firewall 12300 0

with my case:

PYTHONPATH=/usr/lib/python3/dist-packages -- /usr/bin/python3 /usr/bin/sshuttle --method auto --firewall

When I finished editing,visudo says my grammar is wrong; what's my mistake and how to get the things done?

5
  • It would be easier to see what is wrong if you showed the entire line you're trying to put into your sudo configuration and that visudo is unhappy about. My guess would be that you should not include the setting of PYTHONPATH. – Henrik supports the community Jul 22 '19 at 15:02
  • I add this two lines to the end of my sudo configuration Cmnd_Alias SSHUTTLE = /usr/bin/python3 /usr/bin/sshuttle --method auto --firewall iucmr ALL=(root) NOPASSWD: SSHUTTLE – yopuzaze Jul 23 '19 at 10:45
  • Then error when I run sshuttle iucmr@ricn:~$ sshuttle -r root@111.111.111.111 0/0 --dns -x 111.111.111.111 --python '/usr/bin/python3.6' 'sudo: sorry, you are not allowed to set the following environment variables: PYTHONPATH fatal: ['sudo', '-p', '[local sudo] Password: ', 'PYTHONPATH=/usr/lib/python3/dist-packages', '--', '/usr/bin/python3', '/usr/bin/sshuttle', '--method', 'auto', '--firewall'] returned 1 – yopuzaze Jul 23 '19 at 10:49
  • Then error when I run sshuttle iucmr@ricn:~$ sshuttle -r root@111.111.111.111 0/0 --dns -x 111.111.111.111 --python '/usr/bin/python3.6' – yopuzaze Jul 23 '19 at 10:56
  • sudo: sorry, you are not allowed to set the following environment variables: PYTHONPATH fatal: ['sudo', '-p', '[local sudo] Password: ', 'PYTHONPATH=/usr/lib/python3/dist-packages', '--', '/usr/bin/python3', '/usr/bin/sshuttle', '--method', 'auto', '--firewall'] returned 1 – yopuzaze Jul 23 '19 at 10:56
1

Thats it...

# 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        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Defaults        env_keep += PYTHONPATH

# Host alias specification

# User alias specification

# Cmnd alias specification
Cmnd_Alias SSHUTTLE =  /usr/bin/python3 , /usr/bin/sshuttle --method auto --firewall

# User privilege specification
root    ALL=(ALL:ALL) ALL
your_username    ALL=(ALL) NOPASSWD: SSHUTTLE

# 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
5
  • Isn't #includedir /etc/sudoers.dde here a syntax error? What's the intention of that line? – Jeff Schaller Aug 14 '19 at 13:46
  • Actually, it's not a comment; #includedir is a valid directive "used to create a sudoers.d directory that the system package manager can drop sudoers rules into as part of package installation" – Jeff Schaller Aug 14 '19 at 13:52
  • Since you've addressed the sshuttle question with the previous lines, I would suggest removing the last 3 lines altogether. (and perhaps even the last 5 lines) – Jeff Schaller Aug 14 '19 at 13:53
  • Isn't #includedir /etc/sudoers.dde here a syntax error? YES. Editing. – Newton_Jose Aug 14 '19 at 14:03
  • I feel like this post would be better if it focused on answering the question by removing the %sudo section onwards. It doesn't even need the root line. – Jeff Schaller Aug 14 '19 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.