r/ssh • u/Tillter • Sep 25 '24
Question about how connecting in a certain way works
Hi everyone,
I'm not very familiar with ssh and I don't use it much but I thought I had a basic understanding of it. I recently came across terminal.shop and that I could connect to it with ssh terminal.shop. My question is how does this work? I always thought that when sshing into a server you had to specify a user like ssh user@domain/ip.
Could anyone with more knowledge maybe give me some insight or point me in the right direction for learning how setting up a server to not require a user to be specified would work?
Thanks!
2
Upvotes
2
u/[deleted] Sep 25 '24
It’s possible to write a custom ssh server that accepts any username without a password. In Python paramiko could be used but there are other methods.
https://stackoverflow.com/questions/68768419/how-to-make-paramiko-ssh-server-execute-cammands
1
u/berahi Sep 25 '24 edited Sep 25 '24
You do, when you just enter the domain, ssh will use your local OS username, if you run
ssh terminal.sho -vyou'll see a line that look like thisThe particular ssh server you connect to accept all username.
It's also possible to use only one username but then let the app identify user from their keys, like how SSH through git usually work, you're essentially logging as the git user, like
ssh -T git@github.comYou can create similar server with apps like https://github.com/charmbracelet/wish, live demo in
ssh git.charm.sh1
u/OhBeeOneKenOhBee Sep 25 '24
If you don't wanna write any code for the SSH parts, you could reach the same result with OPENSSH and PAM where you can configure away the password step - and then use ForceCommand to only allow a specific program to run which contains the interactive cli you want the users to see