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?
Use the
-v
optipn (1,2,3,4, or 5 times for more and more details):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 settingSSH_DEFAULT_USER
(often used in.bashrc
.Username will be shown somewhere at the beginning in the form of
(
-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.
I failed to read this sentence in your question:
So if that's the case, this answer won't help, as it assumes at least "something" has been done on the client, at some point; however, I'll leave this answer in for those stumbling upon the same issue when using public-key authentication.
Most likely you're logging in using public-key authentication.
Assuming the public-key authentication has been setup using
ssh-copy-id
(this is not the only way it could've been done), on the remote host, look at the contents of~/.ssh/authorized_keys
; there should be at least one entry that looks like so:where
user@hostname
is your local username / hostname (rsa
may be something else).Since you're connecting without specifying a username, unless something in
~/.ssh/config
is overriding this, the session's username will default to your local user's username; hence you're probably logging in to the server using your local user's username (to find out for sure, you could list the remote user's username on the remote host by runningwhoami
while logged in to the remote host).As for the remote user's password on the remote host, it's not stored in cleartext anywhere (hopefully), and you can only attempt to guess it, but if the purpose to recover it is to just keep track of it / log in to the server from other machines without setting up public-key authentication for those machines, you may as well just change it to whatever you want:
At this point you should have everything figured out, and you should be able to log in to the server from other machines using:
replacing
user
with your remote user's username and by typing in the new password.