8

I use one of the many solutions to set the terminal title:

Function in .bashrc:

function set-title() {
  if [[ -z "$ORIG" ]]; then
    ORIG=$PS1
  fi
  TITLE="\[\e]2;$*\a\]"
  PS1=${ORIG}${TITLE}
}

And it works perfectly! But when I ssh to a remote host, the title is changed to ubuntu@remote.host.name.

Is there any solution to prevent title changing after ssh?

i.bondarenko
  • 181
  • 3

1 Answers1

4

If you cannot modify ~/.bashrc I assume you also cannot create or copy any file to the remote user's ~, right? Because if you can, then just add a ~/.bash_aliases that reverts the title to default: echo -ne '\e]2;\a'

So... your best bet is to trick the remote ~/.bashrc by setting a TERM other than xterm*|rxvt*, for example:

$ TERM=gnome-256color ssh ubuntu@remote.host.name

(IMHO, that's a pretty stupid restriction/policy. ~/.bashrc is a file that only runs on interactive sessions, so it won't affect any script or service. And the default .bashrc that ships by default in Ubuntu and other distros have this idiotic behavior of setting the title, it could/should be patched by devs/sysadmins when setting up their servers)

MestreLion
  • 20,726