Announcement

Collapse
No announcement yet.

Sudo doesn't work

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sudo doesn't work

    Hello everybody!

    I had updated my 7.10 to the 8.04 and now I lost my sudo command!

    When I try the 'sudo' command it return the error below:


    Code:
    xykaum@preto:~$ sudo su
    sudo: unable to resolve host preto
    I tried these tips but it didn't worked:

    http://ubuntuforums.org/showthread.p...ghlight=xykaum


    Someone have one idea how to fix it?

    #2
    Re: Sudo doesn't work

    I doubt you have lost "sudo". Try using it with another command, such as "apt-get update".

    Comment


      #3
      Re: Sudo doesn't work

      This is a common problem people are having..
      Ensure hosts in /etc/hosts.conf are the same as in /etc/hostname

      Scott<br />K-Ubuntu 8.04 KDE4

      Comment


        #4
        Re: Sudo doesn't work

        Originally posted by kle
        I doubt you have lost "sudo". Try using it with another command, such as "apt-get update".
        I tried use sudo with others comands before and doesn't work.

        This is a common problem people are having..
        Ensure hosts in /etc/hosts.conf are the same as in /etc/hostname
        Well, my /etc/host.conf have the following content:

        Code:
        #The "order" line is only used by old versions of the C library.
        multi off
        And my hostname is "preto".

        This give you any idea of the problem?

        Comment


          #5
          Re: Sudo doesn't work

          Add your hostname to the first line in /etc/hosts

          If your hostname is "preto" your first line in /etc/hosts should be:

          127.0.0.1 localhost preto

          You probably need to be root to edit /etc/hosts, so you might need to boot into single user mode to edit the file. (I think it's the same as rescue mode.... or if you have the root password, just log in as root :-)

          Comment


            #6
            Re: Sudo doesn't work

            xykaumjunior -

            /etc/host.conf has nothing to do with any sudo issues. The 'best advise' offered so far is to reboot into Rescue Mode (Single User). If you have a visible Grub boot menu, then it should be the second boot menu item. Booting into this mode will put you at a prompt. At this point you should be running as root. From the prompt, type:
            Code:
            groups preto
            This will list the groups that preto (you) belong to. You want to see admin as a listed group. If it isn't listed, then you are not part of the admin group, and that group allows you to gain root permissions.
            Windows no longer obstructs my view.
            Using Kubuntu Linux since March 23, 2007.
            "It is a capital mistake to theorize before one has data." - Sherlock Holmes

            Comment


              #7
              Re: Sudo doesn't work

              Not /etc/hosts.conf but /etc/hosts

              If you take a moment to read the original post you'll see that it's exactly what the error message is:
              "sudo: unable to resolve host preto"

              I've had the exact same problem after upgrading my laptop. Sudo tries to authenticate user@preto. The upgrade has replaced /etc/hosts and the system can't resolv the host preto.

              Comment


                #8
                Re: Sudo doesn't work

                Not to argue (except for the exchange of ideas it will create), but the /etc/hosts file deals with network hosts, not users. Mine (and I have complete sudo access when I need it):
                127.0.0.1 localhost
                127.0.1.1 laptop

                # The following lines are desirable for IPv6 capable hosts
                ::1 ip6-localhost ip6-loopback
                fe00::0 ip6-localnet
                ff00::0 ip6-mcastprefix
                ff02::1 ip6-allnodes
                ff02::2 ip6-allrouters
                ff02::3 ip6-allhosts
                Note that my user name (paul) isn't anywhere in this file.

                A users ability to function as root is controlled by the user being a member of the admin secondary group. If the user doesn't belong to admin then they won't be able to run as root. This can be fixed after booting into Recovery Mode (Single User), and from the prompt issuing the command:
                useradd admin username
                where username is the login name of the user.
                Windows no longer obstructs my view.
                Using Kubuntu Linux since March 23, 2007.
                "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                Comment


                  #9
                  Re: Sudo doesn't work

                  Don't know why sudo wants to resolv the hostname, but it does. Your hostname is laptop. If you remove the second line from your hosts file, then you will get the same problem.

                  First verify that that you no longer can resolv laptop by

                  Code:
                  ping laptop
                  then try sudo ls or something. You will get the same error.

                  Comment


                    #10
                    Re: Sudo doesn't work

                    Okay. I think I 'see' now. sudo needs to be able to validate the request based on the user being identified on it's running host. Is that correct?
                    Windows no longer obstructs my view.
                    Using Kubuntu Linux since March 23, 2007.
                    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                    Comment


                      #11
                      Re: Sudo doesn't work

                      Something like that. I don't know exactly why, but it's pam that's responsible for the authentication. Also I noticed that if you get the hostname resolved from dns it will also work. My router(also my dhcp/dns server) creates a .lan top domain, and automaticly adds my host. So when I ping laptop resolv.conf also containing "search lan" makes it resolv to laptop.lan 10.0.0.5. That's good enough for sudo to.

                      That didn't help me when I had the problem however, since I needed to sudo to get my network running .

                      Comment


                        #12
                        Re: Sudo doesn't work

                        Sorry to be reverting to flippancy here, but that dialogue was absolutely extraordinary. I didn't understand a word of it. Very refreshing, indeed. My compatriot and Snowhog evidently know what they are talking about, which is reassuring. No wonder K/Ubuntu has come such a long way in just the half year I have been using it.

                        Comment


                          #13
                          Re: Sudo doesn't work

                          I am no more than a Kubuntu fan (not fan-atic), having made the break with Windoze several months ago. I'm not a "professional" nor do I make any claims to being an expert in Linux. I've learned a lot since joining this Forum. As I've learned, I try to help others when and where I can. Like doctors who take the Hippocratic Oath, and so accept the prescript:

                          "I will prescribe regimens for the good of my patients according to my ability and my judgment and never do harm to anyone."

                          so do I, provide answers, suggestions, and advise "according to my ability and my judgment" keeping foremost in mind, that in doing so, to "never do harm to anyone."
                          Windows no longer obstructs my view.
                          Using Kubuntu Linux since March 23, 2007.
                          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                          Comment


                            #14
                            Re: Sudo doesn't work

                            I edit my /etc/hosts and put in the first line:

                            Code:
                            127.0.0.1 localhost preto
                            And now my sudo works again.

                            It's good to see the spirit of Ubuntu working here.

                            I have other problems in my Hardy, but I will post in other topics.

                            Thanks everybody.

                            Comment


                              #15
                              Re: Sudo doesn't work

                              Glad that this got you back in good working form. This information concerning the /etc/hosts file and sudo will definitely be put into my knowledge base for future reference.

                              Welcome to the Kubuntu Forums.
                              Windows no longer obstructs my view.
                              Using Kubuntu Linux since March 23, 2007.
                              "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                              Comment

                              Working...
                              X