SSH - SFTP/SCP only + additional command running in background

Posted by Chris on Server Fault See other posts from Server Fault or by Chris
Published on 2012-10-20T10:28:24Z Indexed on 2012/10/20 11:04 UTC
Read the original article Hit count: 181

Filed under:
|
|

there are many solutions described to get ur SSH-connection forced to only run SFTP by modifying the sshd_config by adding a new group match and give that new group a Forcecommand internal-sftp

Well that works great but i would love to have a little more feature.

My servers automatically ban IP's which try to connect often in a short time. So when you use any SFTP-Client, which opens multiple connections to work faster it can get banned instandly by the server for a long time.

The servers have a script to whitelist users by administrator. I've modified this script to whitelist the user, which runs the script.

All i need to do is now get the server to execute that script, when somebody logins. On SSH it's no problem, just put it in .bashrc or something like, but the Forcecommand don't runs these scripts on login.

Is there any way to run such a shellscript before or at the same time as the Forcecommand get fired?

© Server Fault or respective owner

Related posts about ssh

Related posts about sftp