I'm planning a server for the students studying Linux and have some rules for this.

  1. All students will get the same server domain/port for SSH, and each own username/password(normal privilege).

  2. 4 servers will be clustered, and for all users not an admin it will redirect to each own Docker*.

  3. All students will be able to access to the server through the internal network using a SSH client.

The problem is very simple, "how to access to the designated docker using SSH with the same domain/port for each user". It clearly means the server will have to redirect SSH requests to each own Docker depending only on usernames.

The final goal is that all students can write and build their programs on the Linux environment through Bash shell, and do pretty much everything else within the SSH session.

I have read various Docker and SSH documents but not been able to find an appropriate solution. Any help will be appreciated :).


While it's possible that it's XY problem, the reason why I want this because I don't want the server ruined by a single user. So you can suggest another way to acquire this requirement, of course.


A similar question was asked that might answer your question:

Consider using a ForceCommand directive in sshd_config. For example, I use these to force groups of users to a set of servers:

Match Group group1
       ForceCommand ssh -t group1.fqdn

Match Group="*,!local,!group2,!root"
       ForceCommand ssh -t group3.fqdn

You could use:

Match User foo
    ForceCommand ssh -t target-host

I've never used this, but a set of directives, one for each user, could make the "SSH gateway" you're proposing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.