this post was submitted on 13 Mar 2025
281 points (96.4% liked)

Linux

6596 readers
292 users here now

A community for everything relating to the GNU/Linux operating system

Also check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
 

curl https://some-url/ | sh

I see this all over the place nowadays, even in communities that, I would think, should be security conscious. How is that safe? What's stopping the downloaded script from wiping my home directory? If you use this, how can you feel comfortable?

I understand that we have the same problems with the installed application, even if it was downloaded and installed manually. But I feel the bar for making a mistake in a shell script is much lower than in whatever language the main application is written. Don't we have something better than "sh" for this? Something with less power to do harm?

(page 2) 50 comments
sorted by: hot top controversial new old
[–] LodeMike@lemmy.today 4 points 1 week ago
[–] RoyaltyInTraining@lemmy.world 4 points 1 week ago (2 children)

I always try to avoid these, unless the application I'm installing has it's own package management functionality, like Rustup or Nix. Everything else should be handled by the system package manager.

load more comments (2 replies)
[–] mesamunefire@piefed.social 4 points 1 week ago

I usually just take a look at the code with a get request. Then if it looks good, then run manually. Most of the time, it's fine. Sometimes there's something that would break something on the system.

I haven't seen anything explicitly nefarious, but it's better to be safe than sorry.

[–] Boomkop3@reddthat.com 3 points 1 week ago

And don't forget to sudo!

[–] possiblylinux127@lemmy.zip 3 points 1 week ago

Just use a VM or container for installing software. It can go horribly wrong in a isolated place.

[–] knexcar@lemmy.world 3 points 1 week ago (5 children)

What does curl even do? Unstraighten? Seems like any other command I’d blindly paste from an internet thread into a terminal window to try to get something on Linux to work.

[–] Irelephant@lemm.ee 2 points 1 week ago (1 children)

curl sends requests, curl lemmy.world would return the html of lemmy.worlds homepage. piping it into bash means that you are fetching a shell script, and running it.

[–] easily3667@lemmus.org 2 points 1 week ago* (last edited 1 week ago) (1 children)

I think he knows but is commenting on the pathetic state of security culture on Linux. ("Linux is secure so I can do anything without concerns")

[–] Irelephant@lemm.ee 1 points 1 week ago

Security through obsecurity strikes again.

I usually just read the shell script, and then paste that into bash.

load more comments (4 replies)
[–] Kissaki@programming.dev 3 points 1 week ago

| sh stands for shake head at bad practices

[–] nous@programming.dev 2 points 1 week ago (1 children)

Most packages managers can run arbitrary code on install or upgrade or removal. You are trusting the code you choose to run on your system no matter where you get it from. Remember the old bug in ubuntu that ran a rm -rf / usr/.. instead of rm -rf /usr/... and wiped a load of peoples systems?

Flatpacks, Apparmor and snaps are better in this reguard as they are somewhat more sandboxed and can restrict what the applications have access to.

But really if the install script is from the authors of the package then it should be just as trustworthy as the package. But generally I download and read the install scripts as there is no standard they are following and I don't want them touching random system files in ways I am not aware of or cannot undo easily. Sometimes they are just detecting the OS and picking relevant packages to install - maybe with some thrid party repos. Other times they mess with your home partition and do a bunch of stuff including messing with bashrc files to add things to your PATH which I don't like. I would never run a install script that is not from the author of the application though and be very wary of install scripts from a smaller package with fewer users.

load more comments (1 replies)
[–] communism@lemmy.ml 2 points 1 week ago

Just direct it into a file, read the script, and run it if you're happy. It's just a shorthand that doesn't require saving the script that will only be used once.

[–] Scoopta@programming.dev 2 points 1 week ago (1 children)

I also feel incredibly uncomfortable with this. Ultimately it comes down to if you trust the application or not. If you do then this isn't really a problem as regardless they're getting code execution on your machine. If you don't, well then don't install the application. In general I don't like installing applications that aren't from my distro's official repositories but mostly because I like knowing at least they trust it and think it's safe, as opposed to any software that isn't which is more of an unknown.

Also it's unlikely for the script to be malicious if the application is not. Further, I'm not sure a manual install really protects anyone from anything. Inexperienced users will go through great lengths and jump through some impressive hoops to try and make something work, to their own detriment sometimes. My favorite example of this is the LTT Linux challenge. apt did EVERYTHING it could think to do to alert that the steam package was broken and he probably didn't want to install it, and instead of reading the error he just blindly typed out the confirmation statement. Nothing will save a user from ruining their system if they're bound and determined to do something.

[–] Scary_le_Poo@beehaw.org 2 points 1 week ago (1 children)

In this case apt should have failed gracefully. There is no reason for it to continue if a package is broken. If you want to force a broken package, that can be it's own argument.

[–] Scoopta@programming.dev 2 points 1 week ago

I'm not sure that would've made a difference. It already makes you go out of your way to force a broken package. This has been discussed in places before but the simple fact of the matter is a user that doesn't understand what they're doing will perservere. Putting up barriers is a good thing to do to protect users, spending all your time and effort to cover every edge case is a waste of time because users will find ways to shoot themselves in the foot.

load more comments
view more: ‹ prev next ›