You are not logged in.

#1 2013-08-11 06:33:47

sudoku
Member
Registered: 2012-10-31
Posts: 96

[SOLVED] SSH still using old hostname. How to change it for good?

Hello!

I cannot understand how to have SSH use my laptop's new hostname.

My laptop's hostname is:

$ hostname
tpad

However, if I try to ssh from the Eeepc:

$ ssh user1@tpad
ssh: Could not resolve hostname tpad: Name or service not known

But if I connect to the old hostname:

$ ssh user1@sudoku
Welcome to tpad!
...

Where sudoku was my old hostname. Where does Arch go and find that hostname? I thought I got rid of it. Here are my relevant files:

$ cat /etc/hostname 
tpad
$ cat /etc/hosts 
127.0.0.1	localhost.localdomain	localhost tpad
::1		    localhost.localdomain	localhost tpad
# EOF
$ cat /etc/idmapd.conf
[General]
Verbosity = 1
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = tpad

[Mapping]
Nobody-User = nobody
Nobody-Group = nobody

Thank you and all the best!

Last edited by sudoku (2013-08-11 07:54:44)

Offline

#2 2013-08-11 06:50:04

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] SSH still using old hostname. How to change it for good?

Have you changed the Host field in .ssh/config?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2013-08-11 06:59:54

sudoku
Member
Registered: 2012-10-31
Posts: 96

Re: [SOLVED] SSH still using old hostname. How to change it for good?

Do you mean ~/.ssh in the host machine (tpad/sudoku)? There is no config file:

$ ls ~/.ssh
authorized_keys  id_rsa.pub  known_hosts
$ grep -r -i sudoku ~/.ssh
./known_hosts:sudoku ecdsa-sha2-nistp256 [some very long string here]
./id_rsa.pub:ssh-rsa [another very long string here] user1@sudoku

Otherwise, if you mean /etc/ssh:

$ ls /etc/ssh
moduli       ssh_host_dsa_key      ssh_host_ecdsa_key.pub  ssh_host_rsa_key      sshd_config~
ssh_config   ssh_host_dsa_key.pub  ssh_host_key            ssh_host_rsa_key.pub
ssh_config~  ssh_host_ecdsa_key    ssh_host_key.pub        sshd_config

A grep -r -i sudoku /etc/ssh finds occurrences in all files here apart from ssh_config and sshd_config.

Last edited by sudoku (2013-08-11 07:04:47)

Offline

#4 2013-08-11 07:01:25

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] SSH still using old hostname. How to change it for good?

You can create one, or delete your known_hosts. I'd opt for the former, myself...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2013-08-11 07:08:42

sudoku
Member
Registered: 2012-10-31
Posts: 96

Re: [SOLVED] SSH still using old hostname. How to change it for good?

I've removed the ~/.ssh folder.

However, it didn't solve much and I still have to SSH using sudoku although now it's asking me for a password.

Nothing changed by reinstalling openssh and removing /etc/ssh either. Where does Archlinux find that hostname?

Last edited by sudoku (2013-08-11 07:20:26)

Offline

#6 2013-08-11 07:39:13

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] SSH still using old hostname. How to change it for good?

You shouldn't indiscriminately remove those directories...

Create a .ssh/config on your EeePC with the following in it:

Host tpad
   Hostname 192.168.1.XXX
   Port 22
   User user1
   IdentityFile ~/.ssh/id_rsa

where the values for the IP address, port and private key are yours, etc...

Then issue:

ssh tpad

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2013-08-11 07:54:24

sudoku
Member
Registered: 2012-10-31
Posts: 96

Re: [SOLVED] SSH still using old hostname. How to change it for good?

Ah! It worked. So it was actually some leftover setting in the Eeepc. Thank you for your help.

Offline

Board footer

Powered by FluxBB