问题:

homer@ubuntu:~$ python
Python 2.7.6 (default, Jan 25 2014, 12:41:48) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ujson
/usr/local/lib/python2.7/site-packages/setuptools-2.1-py2.7.egg/pkg_resources.py:975: UserWarning: /home/homer/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).

 

问题分析:

/home/homer/.python-eggs 目录可以被 group/others 写入,导致不安全和容易受攻击,这是权限设置不当造成的。

 

解决方法:

修改 group/others 目录的权限

chmod g-wx,o-wx /home/homer/.python-eggs/

 

修改后的结果:

homer@ubuntu:~$ ll /home/homer/

drwxr--r--  8 homer homer   4096  4月 23 13:09 .python-eggs/