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
只能由 root 执行。是什么赋予了?
就我的最新情况而言Arch Linux 机器它按预期工作:
$ 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
每个人都可以执行。
这似乎是由限制性 umask 引起的:
vagrant@archlinux:~$ sudo bash -c umask
0027
事实证明它是在 vagrant 和 root 用户的中设置的.profile
,对于不明原因:
vagrant@archlinux:~$ sudo grep ^umask /root/.profile
umask 027
vagrant@archlinux:~$ grep ^umask ~/.profile
umask 027
答案1
vcard
不仅可以由 root 执行,还可以由 root 组的任何成员执行。这是由现在开始或更严格的umask
限制造成的。只需更改或开始:007
pip2
umask 002
python -c "import os; os.umask(2); os.system('pip2 install vcard')"