There is a script that you want to run when it is relayed on a stepping stone server that is relayed by proxy_command.

Asked 2 years ago, Updated 2 years ago, 127 views

Consider accessing the VPC through the footstool.

For example, if there is any ssh connection, I would like to control it by posting it on the rack.

In particular, even if ProxyCommand does not log in directly to the stepping stone itself when going through the stepping stone, I would like to make this process run somehow.

Question

  • Is it possible for the ssh recipient to write a script for the hook to be executed for all ssh connections (if via ProxyCommand included)?

openssh

2022-09-30 19:48

1 Answers

I haven't tried it, but I think I can do SSH login hook with PAM.

UserPAM is set to yes in /etc/sshd_config and restart
Add the following line to the /etc/pam.d/sshd file

 session optional pam_exec.so seteuid/path/to/your/hook.sh

確認 If you want to check, it is better to test the connection in a separate window without disconnecting the ssh session you are connecting to.


2022-09-30 19:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.