Know what details Ubuntu is using for SSH host

gnome-terminalpasswordssh

On Ubuntu 23.10, when I open a terminal and ssh in to a host I have like this:

ssh hostname.here.com

It logs me in straight away (even when I've first booted up my machine, not just after I've logged in for the frist time in a session). I have no details for the host in my ~/.ssh/config file either.

Now I need to work out what the username/password (and maybe the key file name) is for that host. I have a record but it's a bit confused (and so far no username/password combination works – but that's another matter).

I have looked at Seahorse, but it doesn't seem to list anything obvious for the host.

How do I find out at least what username and/or key file Ubuntu is using to log in to it? Is there something else Ubuntu uses for remembering terminal logins?

Best Answer

How do I find out at least what username and/or key file Ubuntu is using to log in to it? Is there something else Ubuntu uses for remembering terminal logins?

Use the -v optipn (1,2,3,4, or 5 times for more and more details):

ssh -vvvvv hostname.here.com

will show almost every detail about the connection. Including username, encryption used (and where it found the user; and at that location you shpuld also find the password)

Username can come from .ssh/config but can be overwritten by setting SSH_DEFAULT_USER (often used in .bashrc.

Username will be shown somewhere at the beginning in the form of

debug1: Authenticating to {host} as {user}

(-v will show the user too)

If you do not provide a user it likely is using your current user. Otherwise it should error out. And in that case it also will ask you for the password.

Related Question