sudo: unable to resolve host

CptCharis

Well-Known Member
Joined
Feb 27, 2018
Messages
563
Reaction score
465
Credits
982
Hello everybody!!!

I changed my hostname in /etc/hostname
but I can't use sudo anymore

Code:
sudo: unable to resolve host

Any suggestion ?
 
Last edited:


I changed it also /etc/hosts but things were worst.
Finally I place back my old hostname in both files and problem solved but this is not a solution.
I will google and I will be back with updates.
 
Last edited:
I was going to say you need to do it in both, but you got that, goodonyer.

So now I am curious.

I'll await your searches.

Cheers

Wiz
 
Hey @wizardfromoz

Problem solved ;)

I found this command

Code:
sudo hostnamectl set-hostname new-name

My hostname was changed succefully & no any error appears when I use SUDO

FYI hostname was changed in "hostname" file but not in "hosts" file and all this is strange bcz is what exactly I did manually.
I don't really now but with this command no more errors.

C u around!!!

P.S I forgot to mention that now when SUDO is used , is asking for passwd of old Hostname
propably bcz is not changed in hostname file.

:)
 
Last edited:
Goodonyer again :D

Other than that, you could have appended (added) a new hostname in the file after the old, and it sees it as an alias for the other.

On password

Code:
sudo passwd

Cheers

Wiz
 
Hello guys!!!
By the way , I find a much more easier way to change your Host name without any problems.

Menu>Administration>Network
under Network Settings window, in the first tab named General

press unlock & change your Host name.
Don't forget to lock again.
Host name is changing both hosts and hostname files in /etc.
That's it. Thanks.
 

Staff online


Top