Computer Name change

Connection sharing, Firewall, Samba..etc
Forum rules
Before you post please read how to get help
Post Reply
biggocharley
Level 2
Level 2
Posts: 79
Joined: Fri Dec 10, 2010 5:54 pm

Computer Name change

Post by biggocharley »

I have two machines on my network with the same name. How do I change one of these?
GeneC
Level 7
Level 7
Posts: 1598
Joined: Fri Sep 03, 2010 1:59 pm
Location: Maine, USA

Re: Computer Name change

Post by GeneC »

run this command

Code: Select all

gksudo gedit /etc/hostname
change name, save, exit :wink:
biggocharley
Level 2
Level 2
Posts: 79
Joined: Fri Dec 10, 2010 5:54 pm

Re: Computer Name change [SOLVED]

Post by biggocharley »

GeneC wrote:run this command

Code: Select all

gksudo gedit /etc/hostname
change name, save, exit :wink:
Thank you --how simple can it get? :lol:
petersk
Level 1
Level 1
Posts: 36
Joined: Sun Nov 01, 2009 5:10 pm

Re: Computer Name change

Post by petersk »

you likely have to change your /etc/hosts file to make sure the localhost has the 'right' name as well. I think there must be something else to change too.
Kurt
User avatar
Angtagapagligt
Level 4
Level 4
Posts: 223
Joined: Sat Jul 10, 2010 3:14 am

Re: Computer Name change

Post by Angtagapagligt »

petersk wrote:you likely have to change your /etc/hosts file to make sure the localhost has the 'right' name as well. I think there must be something else to change too.
Kurt
I think the hosts file is changed automatically.

But to make it safe open a terminal and type

Code: Select all

cat /etc/hosts
and post the result here.

Angtagapagligt
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect."
  • - Linus Torvalds Interview with David Diamond, September the 28th 2003
Karsten
Level 1
Level 1
Posts: 1
Joined: Wed Oct 17, 2012 9:35 pm

Re: Computer Name change

Post by Karsten »

I think there is a also a safe(r) way for this, at least for Mint 13 / Mate (I translate the names from german to english):
Goto Control center / Network and select the second tab "General" ("Allgemein")
Click the padlock to unlock the settings (admin's password required)
Change the computer name ("Rechnername") and close the dialog.

Mint automatically updates the above mentioned files /etc/hostname and /etc/hosts for you.

Hope this is more comfortable this way,
Karsten
BuckSkin
Level 2
Level 2
Posts: 89
Joined: Tue Jan 15, 2019 9:11 pm

Re: Computer Name change

Post by BuckSkin »

GeneC wrote:
Sun Mar 11, 2012 2:32 pm
run this command

Code: Select all

gksudo gedit /etc/hostname
change name, save, exit :wink:
In Linux Mint 19 Cinnamon, when I copy/paste that command, it tells me that "gksudo" does not exist.
Has something about this changed in Mint 19 ?

Thanks.

EDIT 1: Okay...., I replaced gedit with xed and the text editor popped up with the computer name; I changed it and save.
Now, when I open a terminal, my old name remains; however, when I run the /etc/hostname command again, it displays the new name.

EDIT 2: This is a dual-boot machine; can/should Windows and Mint have different names ?
>>>>> Linux Mint 19.3 Cinnamon 64-bit <<<<<
>>> Virtual Guest on Windows 7 Pro 64-bit Host <<<
>> Network-connected with numerous Windows 7 Machines <<
puddleglum
Level 1
Level 1
Posts: 37
Joined: Fri Dec 22, 2017 12:03 pm

Re: Computer Name change

Post by puddleglum »

I think in Mint 19 you have to use:

Code: Select all

xed admin:///etc/hostname
if gksudo does not exist.
gm10
Level 20
Level 20
Posts: 10999
Joined: Thu Jun 21, 2018 5:11 pm

Re: Computer Name change

Post by gm10 »

BuckSkin wrote:
Thu Jan 17, 2019 4:57 pm
Has something about this changed in Mint 19 ?
You mean if something has changed in the over 6 years that this thread has been dead? Good lord, man...

The correct way to change the hostname these days is this:

Code: Select all

hostnamectl set-hostname YOURNEWNAME
BuckSkin
Level 2
Level 2
Posts: 89
Joined: Tue Jan 15, 2019 9:11 pm

Re: Computer Name change

Post by BuckSkin »

Thanks for the current commands to accomplish this.

As for the ancient thread, since the information is no longer relevant, it should be purged from the system so that it would not show up at the top of the list in searches regarding the topic as it only serves to mislead poor misguided souls such as I.
>>>>> Linux Mint 19.3 Cinnamon 64-bit <<<<<
>>> Virtual Guest on Windows 7 Pro 64-bit Host <<<
>> Network-connected with numerous Windows 7 Machines <<
gm10
Level 20
Level 20
Posts: 10999
Joined: Thu Jun 21, 2018 5:11 pm

Re: Computer Name change

Post by gm10 »

BuckSkin wrote:
Fri Jan 18, 2019 3:01 pm
Thanks for the current commands to accomplish this.

As for the ancient thread, since the information is no longer relevant, it should be purged from the system so that it would not show up at the top of the list in searches regarding the topic as it only serves to mislead poor misguided souls such as I.
You are welcome. That aside, good luck convincing the volunteer moderators to spend their time verifying 6-year old threads. :lol: Just look at the date, that's why it gets printed on every post. Old information can remain relevant, but in particular where system files are involved never use it blindly.
Post Reply

Return to “Other networking topics”