My problem is similar as the one described here.I've three hosts A, B and C.A is the computer I get at home.B is a server that we have at the University which is connected to the Internet.C is a computer in the Office of the University. Connected in the same local network with the server.So I can SSH from A -> B and from B -> C, but not from A -> C. I want a direct connection from A to C.There is a great solution described here.But my problem is that the solution is applied on A host and I preferred a solution that I can put up on host B because I want to make it easy for other users who desire the same connection.I note here that most users are teachers who do not have computer skills.Any help please.
Implement SSH redirection on a remote host
ssh;openssh;port forwarding
First, here's better solution than the one given in the link provided in the question, since this new one has no dependencies on external tools like netcat:Host C  ProxyCommand ssh -W %h:%p Bin the .ssh/config of host A. Users don't need to have specific computer skills, they just need to be informed. Anyone can put 2 lines in a file.If this is really a problem, a specific command could be added to the .ssh/authorized_keys file on host B:command=ssh C ssh-rsa <key_of_the_user_of_host_A>So, when the user does ssh B, instead of starting an interactive shell on host B, the SSH server on host B will automatically run ssh C (see the sshd(8) man page). However this will prevent any direct logging on host B, and any other SSH command, such as /bin/bash -l in ssh -t B /bin/bash -l, will be ignored. As the man page says:The command originally supplied by the client is available in the SSH_ORIGINAL_COMMAND environment variable.So, there may be some room for improvement, either to run the supplied command on host C, or to run it on host B under some conditions (also be careful with quoting if you take this environment variable into account). One example is:command=ssh ${TTY:+-t} C ${SSH_ORIGINAL_COMMAND-$SHELL} ssh-rsa <key>which runs the supplied command on host C if there is one (and will start an interactive shell as usual if there isn't). With this, scp may work, but on my machine it fails with Permission denied errors. But rsync works well and can be used as a replacement for scp if you have problems with it.Important. Do not choose a solution that consists in opening a (necessarily non-privileged) port on host B. Either this will not work because connections to such ports are blocked by the firewall of the University, or this will introduce security issues as this will allow users to bypass authentication (with things like tracing) on host B via the SSH server on port 22.