ssh restrict commands using Python

Viewed 321

I am using a python script to restrict the commands usage using the command argument in the authorized_keys file.

command:

ssh host-name bash --login -c 'exec $0 "$@"' mkdir -p hello

My script is performing required actions to restrict the commands. After filtering, the python script does sys.exit(1) for error and sys.exit(0) for success. After the return value the above ssh command is not getting executed at the end. Is there something else I need to send from the python script to SSH daemon?

2 Answers
Related