Gnome terminal is not showing ssh commands in title bar

With Fedora 40 fresh install, terminal was showing ssh commands in title bar.

when I issue “ssh user@hostname” from terminal, the user and hostname used to appear in top bar automatically. After update (dnf update -y), this feature stopped.

Two things are required to change a terminal windows title.

  1. Configure the terminal program to allow the title to be set.
  2. Print the ESCape sequence to set the title.

I suspect it is (2) that is not happening. Check the code on the remote host is trying to set the title.

Here is a simple bash script that will set the title that you can use to test if (1) or (2) is the problem. I call the script title. It sets to title to its arguments: ./title testing title

#!/bin/bash
printf "\033]0;$*\007"

Added f40, gnome-terminal, workstation

I ran ssh oracle@hostname (Solaris). I ran the 2 lines, bash and printf. The title was completely removed from terminal. Title bar is now black.

In ‘Preferences’ of terminal, ‘Command’ tab, it says: ‘Replace initial title’.

This feature is important to me as I can select the right hostname from its title bar… It was working originally without any configuration before applying Fedora 40 updates that we usually run directly after F40 installation.

Sorry I was clear enough.

  1. Create a new file named “title” with your editor.
  2. Copy those two lines into the file.
  3. save the file
  4. cd to the fo,der you save title into
  5. Type chmod +x title
  6. Type command ./title hello Pierre

Now you have a title command to experiment with.

This worked. It is changing the terminal top bar title as well the current tab title. My intention is to see user@hostname for every terminal session (tab) that I open.

I am wondering why it stopped working after that initial bulk update. /etc/bashrc is the same before and after update.

I used to do nothing for that. It was there by default.

Great you have proved that its not your system that is the problem.
The responsibility to set the title to user@host is on the remote system.
Investigate if something changed on the remote end.

I confirm that:

  1. No changes were made to servers that I am accessing through ssh
  2. I fresh installed Fedora 40 in ‘Boxes’ without any updates. ‘ssh oracle@hostname’ was automatically displayed in the tab bar of GNOME Terminal

So:

  1. ssh oracle@hostname
  2. ssh command is reflected in title bar at this level
  3. Now, password prompt appears: ****
  4. Bash prompt of the hostname appears.

Before update:

  • GNOME Terminal 3.50.1 for GNOME 45 Using VTE version 0.74.2 +BIDI +GNUTLS +ICU +SYSTEMD

After update:

  • GNOME Terminal 3.50.1 for GNOME 45 Using VTE version 0.76.3 +BIDI +GNUTLS +ICU +SYSTEMD.

Please let me state my findings about the issue:

I tried ssh@RedHatLinux and it worked smoothly.

It is not working Oracle SPARC Solaris 11.3 and 11.4 servers.

Then the problem is on those servers not your system.

Did they remove the code to set the title?
Did you change the .bash_profile to not set the title (I think that is where the code is traditionally)?

I have a new finding:

Before Fedora update:
$ ssh abc@def —> Displayed in title bar
$ ssh adsfasdfasdf —> Displayed (non-existing server, whatever string)

After Fedora update:
$ ssh abc@def—> Did not display.
$ ssh asdfasdfasdf —> Did not.

We did not touch our Solaris servers. No changes there.

Does the title always show the command you are running?

No. It is just showing my username@hostname:~ The same is when I open a new tab (Ctrl+Shift+t).

After that, the title bar remains the same throughout the session.

The strange thing is that the tile bar reflects username@hostname when I ssh to Red Hat servers.

Running gnome in a vm i saw that before updating from released f40 some commands i type in gnome terminal are shown in the title bar.
Like ssh badhost and `sleep 10’.

But after an update that stopped happening.

This needs a gnome developer to tell what is going on.
I am not sure where they hang out to ask.

or maybe

In the terminal settings you can make adjustments. It could be that an update was overwriting what you had there.

Under Preferences > Profile > command you can set:

Initial Title. Sometimes I used the $USERNAME@$HOSTNAME variables to achieve what you like to do.
There is also the option When terminal commands set their own titles, you can choose several options.
Could be that there is just a new default and this got overwritten when updating.

Initial Title has ‘Terminal’ value before and after update. All parameters of this screen were not modified.

The text in the titlebar is handled by file “/etc/profile.d/vte.sh”. Upon
examination, I noticed some changes, but that doesn’t appear the cause of your
problem. When executing

gnome-terminal -- bash -l # interactive login

the title contains USER@HOSTNAME: ~ - as it should. When executing

gnome-terminal # interactive non-login

the title contains GTerm: Default - the entry in the preference with
Replace initial title set.
Apparently, the files in directory “/etc/profile.d/” are not being initiated
in an interactive non-login session. My understanding is the files should be
initiated in either case.
When executing

ssh localhost

vte.sh exits after the third condional:

Not running under vte?
[ "${VTE_VERSION:-0}" -ge 3405 ] || return 0

It seems no VTE_VERSION variable exists. Before ssh, echo $VTE_VERSION → 7603.
For the first problem, I recommend making a copy (don’t mess with system files)
of vte.sh in your common directory (common to all users) such as
“/home/common/” and changing name (maybe MyVte.sh) and all permissions as
required. Alter this file to obtain a suitable TITLE.
Then put

#### Use VTE to establish titlebar
if [[ "`ps h -p $PPID -o comm`" == "gnome-terminal-" ]]; then
  source /home/common/MyVte.sh
fi

in the bash resource file.
For the second problem, I don’t know enough about ssh. Someone?

/usr/bin/ssh does not set terminal titles. It never has.
It is the remote login shell that runs may run something to set the title.