1

i have a ssh jumphost. On the sshjumphost i wanna execute
always a python script if user want use my jumphost to jump.

client1 -------- jumphost ---------targethost

Client use following command:

ssh -o ProxyCommand="ssh -W %h:%p test\\\\testuser@jumphost.test.tc" user@targethost

I used the server sshd_config and set

ForceCommand scriptname

But my script dont triggered if a client use the command above.

But if i use following command:

ssh user@jump.test.tc  

then my script was triggered.

What can i do to trigger always a script if a user wanna use my jumphost?

Best regards mobios

0

If you want to run a script on user level the you may need to put that script/command in the /home//.bashrc for BASH shell, put to the right file according to the users login SHELL.

Ex:

[RHuser@LinuxServer ~]$ cat .bashrc

Source global definitions

if [ -f /etc/bashrc ]; then . /etc/bashrc fi

User specific aliases and functions

uname -a;uptime

[RHuser@LinuxServer ~]$

Output

[RHuser@Jumpboxserver ~]$ ssh LinuxServer RHuser@LinuxServer's password: Authentication successful. 20:22:16 up 4 days, 8:22, 1 user, load average: 0.00, 0.00, 0.00 [RHuser@LinuxServer ~]$

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.