As for your last point, you're complaining about nano. It would be perfectly possible for an editor to sudo when writing to disk.
"/etc/mail/aliases" [Read only] 36 lines, 1023 characters
Its simply a matter of remaining keen when doing admin tasks. Sure I have to close/re-open with sudo but its prompting me up front that I won't be able to save it.No, you don't, and yes, you will:
:w !sudo tee % :w !sudo tee % > /dev/null
It's a bit of a hack, but it works.I think there's a sense, which I generally agree with, that random applications asking for your password is something we don't want users to get used to.
If you try creating a new user through the control panel, you'll notice that the default selection is to create a standard user.
Rather what I said. A borked version of sudo.
-Save your modified file to a temp file and work it out with cp or mv after.
or
-Use Vim, and the infamous ":w !sudo tee %".
Nano asks you for the file name/location when you save, just save the file somewhere you have write access to then move it with sudo afterwards. No need to retype your edits.
sudoedit handles this exact case. Try it, it's very convenient. (Of course, you have to set at least one of SUDO_EDITOR, VISUAL or EDITOR correctly.)
You also want to know about visudo, which will save you some oh-shit-I-locked-myself-out moments.
sudo -i
# do root work
exit # or ^D
For example having to type the root password every time I want to run a vaguely administrative program or install something etc gets old fast.
Not to mention the number of times I've made a bunch of edits to something like a conf file in nano and then gone to save and got "permission denied" where the only solution seems to be to exit nano and run it again (and do the edits again) with sudo. Surely it should be able to prompt me for the password at save time?