When I load a particular version of Python on a server, I get the following error:

python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

ldd shows that the file is available and the only surprising thing about it is the permissions, which are as follows:


From the S I conclude that, probably by accident, setgid has been called on the file. But I am also a member of the group that owns the file. Shouldn't I be able to get Python to run in this case, even if non-group members can't?

Python is being loaded by an environment module which does the following:

prepend-path     PATH /path/to/python/2.7.9/bin 
prepend-path     MANPATH /path/to/python/2.7.9/share/man 
prepend-path     PYTHONPATH /path/to/python/2.7.9/lib/python2.7/site-packages:/path/to/spss/22/Python/lib/python2.7/site-packages 
prepend-path     LD_LIBRARY_PATH /path/to/python/2.7.9/lib 
  • How are you loading python on the server? The permissions are strange, but probably not what's causing the problem. – mkomarinski Dec 16 '15 at 15:52
  • What I really meant was that I type "python" on the command line. But I edited the question to show what the environment module does. – Ben Fulton Dec 16 '15 at 16:08
  • I think setgid only takes effect on executables and directories but doesn't otherwise affect library files - you're not running anything, just loading the library into memory. Are you sure the library file is the correct architecture for that system? – mkomarinski Dec 16 '15 at 16:19
  • My boss is able to load the module and run python without a problem. I presume he has more permissions than I do, but I can't imagine what would affect this. – Ben Fulton Dec 16 '15 at 16:23
  • Check the value of your boss' LD_LIBRARY_PATH to yours. If they're the same then I'm really stumped. If they're different, check the directories that are listed and see if there's a different python library kicking around somewhere. – mkomarinski Dec 16 '15 at 16:39

After removing the S permission I was able to load the library correctly. The difference that we finally noticed was that users who were able to load the library actually had their gid set to the same value as the library's gid. It was not sufficient just to be a member of the group for which the library was given permissions - the users had to have it set as their primary group.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.