Putty title changes after login

puttyssh

I am connecting with putty to a stock Ubuntu machine hosted at EC2, and notice the following:

When I connect, the title of the putty window appears at first as the hostname I enter (e.g. "myhostname.com"). After it's connected, the hostname changes to a different string – user@domU-12-31-20-0a-81-AB: ~ (different on each machine).

This look like an ethernet address of sort, I'm not sure. It's really annoying because once I open 2-3 putty consoles I can't remember which is which.

Is it possible a ~/.bashrc script run from the machine itself changes the putty title? Somewhere else I should look into?

Update:

I forgot to mention this … but I have tried this and the title I set up in the connection is shown briefly when connecting, but then overriden just like the default hostname title.

Best Answer

It's most likely updated by your shell prompt ($PS1 in ~/.bashrc or the system-wide /etc/bash.bashrc). Look for \e]2; or \033]2; or a similar escape sequence.

Your given example looks like the usual "<user>@<host>:<path>" template, in which domU-12-31-20-0a-81-AB is the server's hostname as currently configured in the kernel. Most likely, it was assigned by an automated Xen domU creation tool based on your virtual server's Ethernet address.

You can change the current hostname by using hostname newname. To make it persist across reboots, look around in /etc – on every reboot, the hostname is read from the file /etc/hostname (other distributions may use /etc/sysconfig/hostname or similar).

Related Question