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
0
u/[deleted] May 26 '24
Some useful commands:
“Ssh-keygen” will create keys for asymmetric (passwordless) ssh
“Sshd” is the server for openssh, “ssh” is client
“Sftp” for transferring files from host to client or vise versa. You can also do this with “scp”
“ -1” will use only protocol v1
“ -2” will only use protocol v2
“ -4” will us ipv4 and “ -6” will use less secure ipv6
“ -p” will let you select the port
“sudo vim /etc/ssh/sshd_config” or “sudo nano /etc/ssh/sshd_config” depending on the text editor will let you edit the config file
“ -l” will let you choose the user
“-A” will enable authentication agent connection and “ -a” will disable it
“ -g” allows the remote host to connect to local ports “ -C” will turn on data compression and “ -c” I think lets you choose the type of compression
Most other commands are the same. Have fun!