I'm trying to set up a way for users to connect to the same
gateway server for SSH/SFTP (SFTP a priority, SSH nice to have) and have that
gateway server route the users to private servers inside my network identified by username and the private host they want to reach. This has to be a seamless user experience, i.e - no special config file setup, no flags for command line sessions, and no special setting in UI tools like Filezilla.
What I managed to do so far is add this block to my
sshd_config file in the
Match User someuser ForceCommand sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
Now this works great when I'm doing this from a client machine:
ssh -i id_rsa someuser@gateway_server_machine
it will trigger the
ForceCommand and give me an SFTP session to the
When I do
sftp -i id_rsa someuser@gateway_server_machine
the connection hangs and eventually terminated.
so, the sftp doesn't give anything even with verbose - just hangs there - but this is what I get from the server side:
debug1: subsystem: internal-sftp Starting session: forced-command (config) 'sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server ' for someuser from 10.16.2.149 port 58822 id 0
on SSH I get:
Starting session: forced-command (config) 'sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server ' on pts/1 for someuser from 10.16.2.149 port 33550 id 0 debug1: Setting controlling tty using TIOCSCTTY.
I need to figure out what am I doing wrong here, or if there is a better way to provide this kind of connection to my users.