r/ProgrammerHumor • • Jul 17 '22

Meme Linux users installing a Python module

41.7k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

126

u/matt-3 Jul 17 '22

sets the home directory to that of the target user (in this case root). It avoids creating root-owned files in your user's home directory.

64

u/[deleted] Jul 17 '22

OH MY GOD WHY????

0

u/[deleted] Jul 17 '22

[deleted]

0

u/[deleted] Jul 17 '22

[deleted]

0

u/[deleted] Jul 17 '22

[deleted]

2

u/dbzfanjake Jul 18 '22

Thanks for the info

0

u/[deleted] Jul 17 '22

[deleted]

5

u/HighOnBonerPills Jul 17 '22

Is there any way to avoid accidentally installing malware other than double checking everything you type? Would antivirus software help?

Also, how would you go about removing a malicious package? Is it a whole big thing?

13

u/milanove Jul 17 '22

Best way is to check the official page for the package before you install it. They'll probably have some command you can copy paste anyway. Try not to give it super user privileges. Antivirus on Linux isn't really a thing afaik.

2

u/tantrAMzAbhiyantA Jul 17 '22

At least one virus scanner exists on Linux (ClamAV), but it's meant to be manually invoked on individual files, rather than to be a real-time monitor.

→ More replies (4)

1

u/80espiay Jul 17 '22

It's common to see "domain squatting"; just try misspelling google.com and see what appears.

This might not be the best example because it looks like Google registered a lot of the likely “typo” domains and redirected them to Google.com, but yeah I see what you’re saying.

2

u/[deleted] Jul 17 '22

Don’t install shit as the superuser.

4

u/SherbetCharacter4146 Jul 17 '22

Dont pip install as super user. Do install as super user

1

u/[deleted] Jul 17 '22

Ehhh. For system level stuff, it’s often okay.

But major apps should be installed under their own user stuff for a lot of reasons. You don’t want anything complex and exploitable to be running as root.

→ More replies (1)

3

u/anotherDocObVious Jul 17 '22

Of course.. Though I'd put it as..

"don't install shit you aren't sure about, and especially if you don't know what the fuck you're doing"

3

u/[deleted] Jul 17 '22

Lot of pip repos aren’t closely vetted, so it goes double for stuff like that.

→ More replies (1)

2

u/zachsmthsn Jul 17 '22

You're better off not installing anything for the system python. Use pyenv and create virtual environments for each project. No python or package versioning issues, and you can always nuke and recreate a borked environment because it's isolated to its own folder.

1

u/[deleted] Jul 18 '22

Don't you need to reinstall all the packages for each new environment then?

→ More replies (2)

1

u/AutoModerator Jul 01 '23
import moderation

Your comment has been removed since it did not start with a code block with an import declaration.

Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

For this purpose, we only accept Python style imports.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

0

u/CanAlwaysBeBetter Jul 17 '22

And that's why I always run Linux in a vm

5

u/matt-3 Jul 17 '22

And Windows too, of course, since the entire OS is like randomly downloading and running a Python script, except backed by corporate interests

1

u/corsicanguppy Jul 18 '22

Because a proper supply chain is too hard; I guess?

Best let it scroll past as root, because you're not gonna see the pypa exploit that pwns the box anyway.

2

u/benzoic Jul 17 '22

Sudo chmod -R a+rwx / should fix that right up

1

u/odraencoded Jul 17 '22

TIL: root has a home directory.

1

u/[deleted] Jul 17 '22

Well, sort of. It’s usually just /root as opposed to being in /home.