Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Exclamation Lost root access, edited /etc/hostname

    I was tired of a bland hostname, so I foolishly edited /etc/hostname.

    Unfortunately, any time I try to run the sudo command now, it fails because of a faulty gethostname() call. I realize now that I should have used the "hostname <new hostname>" command to change it, but I cannot edit /etc/hostname back to its original setting because I need root permissions!

    Rebooting did not reset the hostname, nor did it update /etc/hosts.
    What can I do to fix my stupid mistake?

  2. #2


    I fixed the problem by following these steps:

    1) Rebooting into recovery mode
    2) Editing /etc/hostname back to its original values
    3) Rebooting normally

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts