this post was submitted on 01 Nov 2024
69 points (82.2% liked)

Linuxsucks

133 readers
138 users here now

Shit on Desktop Linux and its evangelists here

No evangelizing for Linux

founded 3 weeks ago
MODERATORS
 
all 42 comments
sorted by: hot top controversial new old
[–] neidu3@sh.itjust.works 2 points 9 hours ago

Ironically, I did this today when editing /etc/sudoers

[–] ladicius@lemmy.world 23 points 4 days ago (4 children)

Save a copy anywhere, get rights, overwrite original file with new file.

At least try that.

[–] Droggelbecher@lemmy.world 8 points 4 days ago (2 children)

Nice of you to try to help, but I don't think the people who post in this community are open to learning

WRONG

Arch is the only correct choice for an OS!!!

[–] iks@lemmy.world 3 points 4 days ago

Save in /tmp

[–] Empricorn@feddit.nl 3 points 4 days ago (1 children)

But still not exactly like Windows!

[–] superkret@feddit.org 1 points 1 day ago

Actually if you open a file you only have read access to in Windows, it will be exactly the same.
Save it to your desktop, get rights, copy it to its original location.

[–] madthumbs@lemmy.world -2 points 4 days ago

Easiest to rember trick I know of, but most people aren't going to know it the first time they're hit with it. lol

[–] billbasher@lemmy.world 16 points 4 days ago (1 children)

:w !sudo tee %

If you are in vim you can do this

[–] stoicmaverick@lemmy.world 2 points 4 days ago* (last edited 4 days ago) (1 children)

Does it work in Helix as well?

[–] billbasher@lemmy.world 2 points 4 days ago

It looks like you can run shell commands so it should be possible although the syntax may be a bit different. I haven’t used Helix.

[–] Shadow@lemmy.ca 10 points 4 days ago (2 children)

Same shit happens with notepad in windows when editing the hosts file.

[–] MisterD@lemmy.ca 2 points 3 days ago (1 children)

Notepad++ handles this gracefully

It offers to relaunch itself elevated without losing what you just edited.

[–] superkret@feddit.org 1 points 1 day ago

And vim lets you elevate from inside it also.
This isn't an OS issue at all.

[–] madthumbs@lemmy.world -1 points 4 days ago* (last edited 4 days ago) (2 children)

You're right, some AI chat told me it wouldn't even open (by default). But at least it has a decent suggested solution in the error.

[–] lud@lemm.ee 1 points 4 days ago

It's so stupid that it can't bring open an UAC prompt instead. Come on Windows you have a standardized way to elevate! Why don't you use it?

[–] theunknownmuncher@lemmy.world 1 points 4 days ago

Kudos for being willing to try it and see!

One very minor detail to note, in your test you weren't actually overwriting the original file that you opened, but instead Notepad appended a .txt to the filename, which is its default behavior, but you still got the same type or error because you didn't have write permission for any file in that directory.

[–] Clent@lemmy.world 7 points 4 days ago
:w !sudo tee %

Further research because you wouldn't use sudo for something you don't understand, right?

Right?!?

[–] Ephera@lemmy.ml 5 points 4 days ago (1 children)

Modern versions of Vim warn about this. I guess, this might still be an annoyance with other editors?

[–] Steamymoomilk@sh.itjust.works 3 points 3 days ago

This is why i love micro. When you tell it to save without sudo it asks to elevate your privileges.

[–] baggins@lemmy.ca 1 points 4 days ago

I saw a one liner somewhere that lets you privesc the vi process you're running from the vi command prompt

[–] Anticorp@lemmy.world 0 points 4 days ago

If you open it in code instead of vim or nano, then you can escalate the privileges if needed. It's also easier to work with overall.

[–] theunknownmuncher@lemmy.world 0 points 4 days ago (2 children)

The bike meme is accurate in that it is you who did it to yourself

[–] GBU_28@lemm.ee 5 points 4 days ago (1 children)

This description accurately describes the joke

[–] theunknownmuncher@lemmy.world -2 points 4 days ago (1 children)

Based on the community, I figured it was trying to imply that this is somehow Linux's fault

[–] GBU_28@lemm.ee 2 points 4 days ago (1 children)

This reply is a reasonable consideration

[–] theunknownmuncher@lemmy.world -1 points 4 days ago

Based on the other replies to my original comment, it seems that I was right...