I'm trying to run a script/shell just after I login via ssh to my host with a "guestUser" the mission of this user is to connect to another remote host via ssh, I've created this user on my host:
guestUser:x:1234:1234::/home/guest:/bin/bash
Then, in guest directory I have a .bashrc
file where I add this, following this answer (Linux: How to automatically run commands on SSH login?):
if[[ -n $SSH_CONNECTION ]] ; then
ssh 192.198.1.99
fi
I did this because I need in this step "guestUser" introduces sshUserInRemoteTwo and sshUserPasswordInRemoteTwo. It does not work. The script tries to log "guestUser" in the remoteHostTwo
as "guestUser", that's not the goal, I need the script asks for user/password.
If I get it works: script asks for user/password and login correctly on the second host, then, once SHH connection with the second host is over, guestUser being offline my host; because at the moment, SSH connection is over and user keeps on my host.