Get rid of unnecessary /chrootjail/lib files
I am not sure if I should actually publish this because it seems like hitting a fly with a nuke.
This is a python script that goes through a chroot jail’s directory (in my case, /chroot/lib) and removes one file at a time. It then tries sftping into the server using a restricted user; if the user is able to connect and transfer the file, the file is removed. Otherwise, it is kept.
This requires Paramiko to execute the sftp connection. I am sure there are better ways to do it, but this works. (For some reason, just calculating the requirements /didn’t/ work for me.)