4

I have a server running Ubuntu 24.02. The server currently has a user named alpha, and when a client inputs ssh [email protected] into their terminal, they are instantly logged in - no password required - and served an interactive application using ForceCommand. However, my goal is for this behavior to occur without having to specify a username, so that typing ssh mydomain.net would do the same behavior. I'm unsure as to how to counteract the behavior that automatically attempts to login using the local machine's username, and I don't wish to require end users to modify their SSH config.

The behavior is similar to terminal.shop - if one types ssh terminal.shop it will automatically serve the application to them without requiring a username to be specified.

Would it also be possible to have a default case where if no username is specified for the connection, they will be served the interactive application, but if a username is specified (such as administrator of the website logging in to perform maintenance tasks) then it will attempt to login to that specific user instead?

Thanks for the help!

5
  • 1
    You should do some research on how ssh works. As far as I know not having a user does not work. That would be a major security flaw, any one could access the remote machine.
    – David DE
    Commented Aug 7 at 12:32
  • End users can create their own config in their home directory that only affects their use of ssh. This does not require sudo and does not affect other users of that computer. In effect you can have a shortcut in this config where any_word will be expended to [email protected]. Then the user could type ssh any_word.
    – user68186
    Commented Aug 7 at 13:18
  • The SSH protocol requires to specify an username. You cannot login without an username. The server terminal.shop you are mentioning probably works in such a way that it accepts any username. Maybe it is possible to configure such behavior using options in sshd_config file. You have to read the man page on that and experiment.
    – raj
    Commented Aug 7 at 14:44
  • 1
    You may find this discussion helpful (at least to understand why it's not at all trivial to implement on the server side): pam module to remap ssh users Commented Aug 7 at 17:02
  • 2
    unix.stackexchange.com/q/307330/70524
    – muru
    Commented Aug 7 at 23:46

1 Answer 1

1

Terminal.shop has a customized ssh daemon that accepts any username without password authentication.

Based on the information acquired when running ssh -vvv terminal.shop it's written in Go, and obviously presents a custom application.

SSH is a protocol. How to handle credentials is up the implementation. The standard implementation (openssh) is made for remote login, and thus validates username and password (or other credentials).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .