Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Set word-read permissions on python libs

In an environment where the default umask is 0077 or similar, the pip utility for installing python libraries can set up new files that cannot be read by all users. I dropped this script into my ~/bin dir so I can enforce other-read permissions easily on all the python libs. I wrote this script after hours and hours of troubleshooting python libs just to find out it's an old-school permissions issue. #!/bin/sh # File: /usr/local/bin/set-readable-python-libs worldreadpythonlibs_version="2019-05-31a" for word in /usr/{local/,}lib{,64}/python* ; do find ${word} ! -perm -o+rX -exec chmod g+rX,o+rX {} + 2>/dev/null done https://gist.github.com/bgstack15/b435b1120192a7dcbd032583e0ade46e

Comments