Ironically, I did this today when editing /etc/sudoers
Linuxsucks
Shit on Desktop Linux and its evangelists here
No evangelizing for Linux
Save a copy anywhere, get rights, overwrite original file with new file.
At least try that.
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!!!
Save in /tmp
But still not exactly like Windows!
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.
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
:w !sudo tee %
If you are in vim you can do this
Does it work in Helix as well?
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.
Same shit happens with notepad in windows when editing the hosts file.
Notepad++ handles this gracefully
It offers to relaunch itself elevated without losing what you just edited.
And vim lets you elevate from inside it also.
This isn't an OS issue at all.
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.
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?
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.
:w !sudo tee %
Further research because you wouldn't use sudo for something you don't understand, right?
Right?!?
Modern versions of Vim warn about this. I guess, this might still be an annoyance with other editors?
This is why i love micro. When you tell it to save without sudo it asks to elevate your privileges.
I saw a one liner somewhere that lets you privesc the vi process you're running from the vi command prompt
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.
The bike meme is accurate in that it is you who did it to yourself
This description accurately describes the joke
Based on the community, I figured it was trying to imply that this is somehow Linux's fault
This reply is a reasonable consideration
Based on the other replies to my original comment, it seems that I was right...