Announcement

Collapse
No announcement yet.

[SOLVED]sudo: unable to resolve host kasun~cse???

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

    [SOLVED]sudo: unable to resolve host kasun~cse???

    Yesterday I changed my hostname to 'kasun~cse' by editing the file /etc/hostname.

    But after changing the filewhen I implement network related commands I get the following error .
    sudo: unable to resolve host kasun~cse
    I couldn't understand why this happens. Do I have to edit some more other names such as dnsdomainname as well
    Please give me a solution for this.
    Thanks.


    --------<br />Kasun Gajasinghe,<br />University of Moratuwa,<br />Sri Lanka.<br /><br />Blog: http://kasunbg.blogspot.com<br />Twitter: http://twitter.com/kasunbg

    #2
    Re: sudo: unable to resolve host kasun~cse

    If you change your /etc/hostname, you'll also have to make the change in /etc/hosts file for sudo to function.

    Since you cannot edit /etc/hosts anymore (because sudo doesn't work), boot into recovery mode to get a root console, and edit /etc/hosts with nano (or the CLI editor of your choice) with 'nano /etc/hosts' and replace your old hostname with the new one (Ctrl+O will write your changes to disk). Then reboot with 'reboot'.

    Comment


      #3
      Re: sudo: unable to resolve host kasun~cse

      Thanks for the help kubicle...
      But what is the need to go to recovery mode

      Since you cannot edit /etc/hosts anymore (because sudo doesn't work)
      My sudo command works fine. Can't we change /etc/hosts file with it
      I haven't tried it yet. Please reply!
      Thanks...
      --------<br />Kasun Gajasinghe,<br />University of Moratuwa,<br />Sri Lanka.<br /><br />Blog: http://kasunbg.blogspot.com<br />Twitter: http://twitter.com/kasunbg

      Comment


        #4
        Re: sudo: unable to resolve host kasun~cse

        Originally posted by kasunbg
        My sudo command works fine. Can't we change /etc/hosts file with it
        Sure...mismatching /etc/hostname and /etc/hosts used to render sudo inoperable, it might have been 'fixed'.

        Code:
        kdesudo kate /etc/hosts

        Comment


          #5
          Re: sudo: unable to resolve host kasun~cse

          Thanks kubicle. it worked.
          --------<br />Kasun Gajasinghe,<br />University of Moratuwa,<br />Sri Lanka.<br /><br />Blog: http://kasunbg.blogspot.com<br />Twitter: http://twitter.com/kasunbg

          Comment

          Working...
          X