Thread: SUDO problem

  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Rep Power

    SUDO problem

    Hi, I am using python version 2.7.3 on UBUNTU. I am using 'sudo' to run a bash command in login page. It is giving me error 'sudo unable to resolv host 'hostname'.
    In the command line, when I use the command 'sudo hostname', it is giving me the error as well as the output. Can any one help... please?? This is my sudoers file. Please suggest me the changes in sudoers file if any:
    # /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
    #Defaults        requiretty
    # Host alias specification
    # User alias specification
    # Cmnd alias specification
    # User privilege specification
    root    ALL=(ALL) ALL
    tester  ALL=(ALL) NOPASSWD: ALL
    www-data 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
    www-data ALL=NOPASSWD: ALL
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Rep Power
    Your syntax is wrong for www-data, look at some of the other users
    Doug G
    I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton
  4. #3
  5. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Woodland Hills, Los Angeles County, California, USA
    Rep Power
    Just another question? Why are you trying to give your www-data user permissions to run sudo on any command with NO password. That's a HUGE security hole. At the most, you should only allow it to run a specific command.

    Comments on this post

    • ishnid agrees
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Brooklyn, NYC
    Rep Power
    As per the error info "sudo unable to resolv host 'hostname" the issue may be in host file

    Go to System -> Administration -> Network -> Hosts

    Check the entry for and see if it matches the hostname. Also paste the following output

    cat /etc/hosts

IMN logo majestic logo threadwatch logo seochat tools logo