Editing configuration files

Brian ad44 at cityscape.co.uk
Fri Nov 23 19:59:05 UTC 2018


On Fri 23 Nov 2018 at 19:48:30 +0100, Ralf Mardorf via ubuntu-users wrote:

> On Fri, 23 Nov 2018 18:29:05 +0000, Ian Bruntlett wrote:
> >What is the preferred way to edit text configuration files that require
> >root access?
> 
> Hi,
> 
> it depends on the config file you want to edit. If you want to edit
> /etc/sudoers you should use visudo, since it locks the file and checks
> the file's syntax. The "vi" in visudo doesn't mean that you must use
> "vi", you could use the another editor, since by default it cares about
> the VISUAL and EDITOR variables. I'm using nano, for visudo, but
> sometimes I'm even using dconf based GUI editors for some config
> files, which could lead to /run/user/*/dconf/user owner issues, that
> could be resolved by simply deleting /run/user/*/dconf/user after
> usage. OTOH some GUI editors aren't that odd, for example xfw could be
> used and doesn't cause such an owner issue. I sometimes like to use meld
> to edit files and to compare it with backups or "new" files installed
> by an upgrade, while the old file is kept.

The comment on visudo is very perceptive, informative and useful. The
same comment applies to vigr and vipw. For editing /etc/default/grub
any editor is good enough.

-- 
Brian.



More information about the ubuntu-users mailing list