Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

In my Vagrant instance:

vagrant@archlinux:~$ sudo pip2 install vcard
Downloading/unpacking vcard
  Downloading vcard-0.9.tar.gz
  Running setup.py (path:/tmp/pip_build_root/vcard/setup.py) egg_info for package vcard

Requirement already satisfied (use --upgrade to upgrade): isodate in /usr/lib/python2.7/site-packages (from vcard)
Installing collected packages: vcard
  Running setup.py install for vcard

    Installing vcard script to /usr/bin
Successfully installed vcard
Cleaning up...
vagrant@archlinux:~$ ls -l $(which vcard)
which: no vcard in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
total 0
vagrant@archlinux:~$ ls -l /usr/bin/vcard
-rwxr-x--- 1 root root 286 Nov  9 10:42 /usr/bin/vcard

/usr/bin/vcard is only executable by root. What gives?

On my up-to-date Arch Linux machine it works as expected:

$ sudo pip2 install vcard
Downloading/unpacking vcard
  Downloading vcard-0.9.tar.gz
  Running setup.py (path:/tmp/pip_build_root/vcard/setup.py) egg_info for package vcard

Requirement already satisfied (use --upgrade to upgrade): isodate in /usr/lib/python2.7/site-packages (from vcard)
Installing collected packages: vcard
  Running setup.py install for vcard

    Installing vcard script to /usr/bin
Successfully installed vcard
Cleaning up...
$ ls -l $(which vcard)
-rwxr-xr-x 1 root root 286 Nov  9 10:40 /usr/bin/vcard

/usr/bin/vcard is executable by everyone.


It seems this is caused by a restrictive umask:

vagrant@archlinux:~$ sudo bash -c umask
0027

Turns out it's set in the both the vagrant and root users's .profile, for unknown reasons:

vagrant@archlinux:~$ sudo grep ^umask /root/.profile
umask 027
vagrant@archlinux:~$ grep ^umask ~/.profile
umask 027
share|improve this question
    
Have you looked at the default umask on vagrant? –  Anthon Nov 9 '14 at 11:04
    
If you set umask 007 and install vcard the executable will be -rwxrwx--- (at least in a virtualenv). –  Anthon Nov 9 '14 at 11:11
    
Try python -c "import os; print os.umask(0)" –  Anthon Nov 9 '14 at 11:13
    
From my experiments with umask and installing vcard, pip2 just follows the umask it gest from the environment –  Anthon Nov 9 '14 at 11:17
    
have you looked at the permissions on pip2 and/or the python executable? –  Anthon Nov 9 '14 at 11:21

1 Answer 1

up vote 1 down vote accepted

vcard is not only executable by root, but also by any member of the group root. This is caused by the umask being 007 or even more restrictive at the moment pip2 is started. Just change with umask 002 or start with:

python -c "import os; os.umask(2); os.system('pip2 install vcard')"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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