What happens if you ssh your user

I know this question is kinda dumb but what happens if you ssh yourself

What do you mean with that? SSH is used to log in remote on another system. Do you have the same user installed on the other system (at least with the same username, but maybe even with the same UID)? When yes, then you log in as that “same” user on the other system and a login shell is started on the other system and the user that did the ssh command sees the shell prompt of that remote shell.

I mean what happens if you break the idea of ssh

by ssh to your username and ip address

like not trying to ssh another computer or different user

like to ssh in your machine

English is not my first language

You mean ssh localhost (or to the name of the host or the IP address of it). Well, first the sshd must be running on that system of course and further it will work the same I assume (why not). But just try it.

Example:

mgi@boven:~> ssh beneden
(mgi@beneden) Password: 
Have a lot of fun...
Last login: Wed Mar 12 11:30:09 2025 from 10.0.0.155
mgi@beneden:~> ssh beneden
(mgi@beneden) Password: 
Have a lot of fun...
Last login: Wed Mar 12 11:30:49 2025 from 10.0.0.154
mgi@beneden:~> 

As you see from the prompts, I start as user mgi on host boven.
Then I set up a connection to host beneden, Apparently sshd is running and user mgi is available.
Then I again set up a connection from beneden to beneden and that works the same.
And now two bash are running:

mgi@beneden:~> ps -ef | grep bash
mgi      16465 16458  0 11:30 pts/1    00:00:00 -bash
mgi      16535 16522  0 11:30 pts/2    00:00:00 -bash
mgi      16816 16535  0 11:33 pts/2    00:00:00 grep --color=auto bash
mgi@beneden:~>

I do not see a use case though, but you may see different.

this like a lag machine right

Sorry, do not understand that.

There’s probably a slight performance hit, but nothing overly significant. Just like it uses memory and CPU, but a negligible amount.

There can be use cases for doing exactly this - for example, if you use a different port number and have a service running you want to connect to (say, gitlab, for example).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.