Bug 331429 - Tab title for SSH connections does not display username (%u) when using .ssh/config data
Summary: Tab title for SSH connections does not display username (%u) when using .ssh/...
Status: CONFIRMED
Alias: None
Product: konsole
Classification: Applications
Component: tabbar (show other bugs)
Version: master
Platform: openSUSE Linux
: NOR minor
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-23 09:58 UTC by Lassi Väätämöinen
Modified: 2022-03-15 00:05 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lassi Väätämöinen 2014-02-23 09:58:52 UTC
The tab title does not display username, but just empty braces "()" when connection information is taken from .ssh/config file. Tab title format is the default (%u) %H.

Without looking at the source code, it looks like Konsole is just parsing the command line for the user info, and now that the data is not available there, the username is not used for tab title.

Reproducible: Always

Steps to Reproduce:
1. create a .ssh/config host entry that contains username:

Host <hostname to use on commandline>
        HostName <ssh server full address>
        User <username>


2. Open Konsole 
3. 'ssh <hostname to use on commandline>'
4. Observe the tab title
Actual Results:  
Tab title is "() <hostname to use on commandline>" 

Expected Results:  
Tab title should be "(<username>) <hostname to use on commandline>"
Comment 1 Kurt Hindenburg 2014-02-23 13:59:35 UTC
Yes, this has been brought up before - AFAIK the only way to do this would be to parse the .ssh/config and that's a bit extreme.
Comment 2 Lassi Väätämöinen 2014-02-23 16:12:11 UTC
Could we employ the remote machine environment after login, say, for example $USER ?
Comment 3 Kurt Hindenburg 2014-02-25 15:00:29 UTC
No, I don't think so - konsole is not running on the remote server - only ssh is. 

Basically, you'll have to use: ssh user@server if you want konsole tabs to work.
Comment 4 Karsten 2014-06-05 09:37:15 UTC
How about find process of pts?
#ps -ef | grep ssh
shows the ssh command, doesn't matter if started via script. If this is found out tab title can be updated as it would be plain ssh command?
Comment 5 Karsten 2014-06-05 09:56:50 UTC
I do it now like this:

saving my ssh paramters in an extra script and doin:

ssh $(cat <my_ssh_options>)

and Konsole sees it as ssh command
Comment 6 Justin Zobel 2020-11-03 06:18:28 UTC
This is still an issue on git master.
Comment 7 Kurt Hindenburg 2021-03-25 04:52:09 UTC
I'm open to suggestions on how to make any improvements.  Are there any other terminal apps that do this?
Comment 8 Forest 2022-03-15 00:05:09 UTC
This behavior also turns up without ~/.ssh/config, if the user just runs "ssh hostname", as is common when the remote and local username is the same.

These days, I think escape sequences in the bash PS1 var are so widely used that it might be better to just let the remote shell set the tab title. This has the benefit of showing the correct remote username when su or sudo are used. To make Konsole do this, set the remote tab title format to "%w".

I haven't been using other shells or many distros lately, so I don't know if %w would be a good default.