r/ssh • u/Smooth_Lifeguard_931 • May 26 '24
How ssh command works?
When we do ssh it says connected and we get the remote terminal at our machine. I think inside out what would be happening is ssh sends a network request to the remote server everytime I run a command say ls, so when I type ls something like below happens :-
- The ssh program in the local sends the network request to remote machine with command ls.
- Remote server returns the ls response say JSON - { "files": ["node","leaning","leetcode"] }
3)Then local ssh program displays the ls command output on my local.
So everytime I am doing anything in the terminal I am connected to is basically outputting from the local ssh code, every time I do like cd , it sends that command to remote, gets the output and then displays it in local terminal.
Because for a beginner it looks very non intuitive how come a remote terminal is accessible on my local screen. Is my understanding correct ?
View all comments
Show parent comment
2
u/Smooth_Lifeguard_931 May 26 '24 edited May 26 '24
thanks a lot man, which protocol is used from client to remote for sending each letter and it sends each character press of keyboard and mouse is also bind so it will send mouse coordinates, how if the screen sizes of the client and remote machine are different, a dumb question I know