ssokolow / quicktile

Adds window-tiling hotkeys to any X11 desktop. (An analogue to WinSplit Revolution for people who don't want to use Compiz Grid)
https://ssokolow.com/quicktile/
GNU General Public License v2.0
878 stars 79 forks source link

Don't create files with root perms on non-root pip cache directory #125

Closed luzfcb closed 1 year ago

luzfcb commented 3 years ago

Description

This pr update the docs and some scripts to include -H argument on sudo when using pip to avoid creating files with root permissions on non-root pip cache directory

Rationale

After pip 6.0.0 (I don't remember which exact version this was included with.), by default pip creates a cache directory in $HOME/.cache/pip/ and store the wheel/egg packages. The $HOME is the current user home directory.

When we use:

sudo pip3 install some-package

pip will continue to use the current user's pip cache directory, however, new files and directories within the cache folder will be created with the owner defined as root, that is, we will end up having files and a directory inside the current user home that the current user cannot read or write without root permission.

This is not a problem that pip can solve on its own. This is where the sudo -H argument comes in. The best explanation of what -H does comes from the sudo documentation

     -H, --set-home
                 Request that the security policy set the HOME environment variable to the home
                 directory specified by the target user's password database entry.

That is, with sudo -H pip will use /root/.cache/pip instead of /home/<my-user>/.cache/pip/.

Whenever we need to install some python package with pip and sudo is necessary, it is recommended to use -H in sudo to avoid future headaches.

ssokolow commented 1 year ago

Sorry for taking so long to get to this. I hadn't realized COVID's effects on society were rolling me down into a hole and wound up silently dropping all my hobby projects on the floor.

I'll add an entry for you to the AUTHORS file in a moment.

ssokolow commented 1 year ago

Done. aea621c9e187691dcd30955e2e17b43527503582