ruggerio
Posts: 33
Joined: Tue Jun 11, 2013 11:36 am

SSH-Terminal not showing target hostname

Thu May 08, 2014 12:04 pm

Hi,

If i connect from my computer a to b via ssh, i would like to see the terminal-title user@b for better recognition, as i have many time more than a couple terminal sessions opened.

unfortunately, for the moment, it shows me user@a (the source-host).

Anybody aware of where changing this?

Thx
Roger

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: SSH-Terminal not showing target hostname

Thu May 08, 2014 12:07 pm

What's in /etc/hostname ? That's where the name displayed on your ssh session originates.

Hostname has strict rules.
/usr/bin/raspi-config wrote: Please note: RFCs mandate that a hostname's labels \
may contain only the ASCII letters 'a' through 'z' (case-insensitive),
the digits '0' through '9', and the hyphen.
Hostname labels cannot begin or end with a hyphen.
No other symbols, punctuation characters, or blank spaces are permitted.\
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
jojopi
Posts: 3271
Joined: Tue Oct 11, 2011 8:38 pm

Re: SSH-Terminal not showing target hostname

Thu May 08, 2014 2:33 pm

The default ~/.bashrc in Raspbian already tries to update the window title at each prompt:

Code: Select all

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac
This could fail if "user@b" does not have the default dot files from /etc/skel, or is using a shell other than bash, or if "user@a" has a TERM setting other than xterm or rxvt.

(Or machines "a" and "b" could have the same hostname. But surely that would be obvious.)

evilkitty
Posts: 380
Joined: Tue Apr 15, 2014 11:39 pm

Re: SSH-Terminal not showing target hostname

Fri May 09, 2014 2:09 pm

what terminal (or ssh client) are you using?
you may find this thread useful
http://ubuntuforums.org/showthread.php?t=2216742
My Pi Server: http://imgur.com/a/6xIUI | Thermostat: http://imgur.com/a/4LVnT

ruggerio
Posts: 33
Joined: Tue Jun 11, 2013 11:36 am

SOLVED SSH-Terminal not showing target hostname

Sat May 10, 2014 6:42 pm

In fact it was the solution of jojopi.

What i didnt check, is the fact, that if you activate root, this isnt set. But it is set on each new user, you create.

Thanks!

Return to “Raspberry Pi OS”