Thread: SUDO problem

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

    Join Date
    Mar 2013
    Posts
    6
    Rep Power
    0

    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:
    Code:
    # /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
    Posts
    14,443
    Rep Power
    4539
    Your syntax is wrong for www-data, look at some of the other users
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  4. #3
  5. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    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
    Location
    Brooklyn, NYC
    Posts
    34
    Rep Power
    3
    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 127.0.1.1 and see if it matches the hostname. Also paste the following output

    cat /etc/hosts

IMN logo majestic logo threadwatch logo seochat tools logo