You are not logged in.

#1 2008-03-17 16:40:43

Majorix
Member
Registered: 2008-01-31
Posts: 96

Safe way to edit system configuration files?

What is a safe way to edit a system configuration file? I mean I did this twice: I edited rc.conf, rebooted and the system failed to boot. Then I had to edit out the typos with a LiveCD.

Is there like a visudo (that edits /etc/sudoers) for rc.conf, xorg.conf, fstab and so on?

Thanks!

Offline

#2 2008-03-17 16:48:37

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: Safe way to edit system configuration files?

You can only edit system config files as root. I don't know what you want exactly, because there isn't a safer way than to limit access to those files to root-only. Using sudo would just be the same.

If you're worried about making a certain configuration, just ask on the forum first.

Last edited by dyscoria (2008-03-17 16:49:27)


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#3 2008-03-17 16:48:56

slackhack
Member
Registered: 2004-06-30
Posts: 738

Re: Safe way to edit system configuration files?

What you edit it in doesn't matter. If it won't boot because of the file, it won't boot because of the file. You really have no choice then but to boot to a liveCD to change it, whether you edit it in vim, nano, emacs, kate, or anything else. visudo has nothing to do with system configuration files, I don't really understand your question on that.

Offline

#4 2008-03-17 16:55:48

Majorix
Member
Registered: 2008-01-31
Posts: 96

Re: Safe way to edit system configuration files?

No I am of course editing those files with sudo. But the problem is, gedit won't check the file for possible errors, thus if you too oversee it and try to reboot using those system files, you will fail.

visudo checks you while you edit, so if you make an error it will warn you in the end.

I was asking if there was a similar tool for the rest of the configuration files.

Sorry for not being clear.

Offline

#5 2008-03-17 16:59:46

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: Safe way to edit system configuration files?

visudo is merely using the text editor vi, which has that extra functionality. You can also use vim.

pacman -Rscn emacs
pacman -Sy vim

Then you can do:

su
vim /etc/rc.conf

*the emacs bit is a joke big_smile*

Last edited by dyscoria (2008-03-17 17:00:21)


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#6 2008-03-17 17:24:21

slackhack
Member
Registered: 2004-06-30
Posts: 738

Re: Safe way to edit system configuration files?

Majorix wrote:

No I am of course editing those files with sudo. But the problem is, gedit won't check the file for possible errors, thus if you too oversee it and try to reboot using those system files, you will fail.

visudo checks you while you edit, so if you make an error it will warn you in the end.

I was asking if there was a similar tool for the rest of the configuration files.

Sorry for not being clear.

Oh -- a kind of a babysitter, you mean?

j/k, i screw up config files all the time. tongue

No, as far as I know there is nothing like that for most files. some do have functionality like that, like I think lilo warns you when you write to lilo.conf and the file has errors. and you can run something like testparm for the smb.conf file, and I think there something similar to check apache config files, etc. but for the standard system config files or arch-specific files like rc.conf, fstab, etc. I don't think there is anything. you just have to be sure not to make any mistakes! big_smile

Offline

#7 2008-03-17 17:25:50

slackhack
Member
Registered: 2004-06-30
Posts: 738

Re: Safe way to edit system configuration files?

dyscoria wrote:

visudo is merely using the text editor vi, which has that extra functionality. You can also use vim.

pacman -Rscn emacs
pacman -Sy vim

Then you can do:

su
vim /etc/rc.conf

*the emacs bit is a joke big_smile*

lol

does anyone actually use emacs? I've never used it a day in my life, and don't know anyone who actually does use it.

/ducks

Offline

#8 2008-03-17 17:57:03

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Safe way to edit system configuration files?

Use an editor with syntax highlighting, that reveals errors pretty often.

Offline

#9 2008-03-17 18:04:36

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Safe way to edit system configuration files?

rc.conf is technically a shell script, so if you source it after you edit it, you might pick up some syntax errors...

Dusty

Offline

#10 2008-03-17 18:10:17

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Safe way to edit system configuration files?

I started off using nano. Now I'm getting comfortable with vim. Next, I'll try emacs...
baby steps....baby steps...

Offline

#11 2008-03-17 18:12:59

Majorix
Member
Registered: 2008-01-31
Posts: 96

Re: Safe way to edit system configuration files?

Ramses de Norre wrote:

Use an editor with syntax highlighting, that reveals errors pretty often.

That's a good idea.

rc.conf is technically a shell script, so if you source it after you edit it, you might pick up some syntax errors...

That's also a very nice idea smile

Offline

#12 2008-03-18 01:26:42

tigrmesh
IRC Op
From: Florida, US
Registered: 2007-12-11
Posts: 794

Re: Safe way to edit system configuration files?

slackhack wrote:

does anyone actually use emacs? I've never used it a day in my life, and don't know anyone who actually does use it.

/ducks

I use emacs.  It's a pain in the a** to set up (google is my friend).  But once you've got it set up, it's great.

No need to duck.  smile

Offline

#13 2008-03-18 05:57:33

BC
Member
Registered: 2008-01-29
Posts: 83

Re: Safe way to edit system configuration files?

tigrmesh wrote:
slackhack wrote:

does anyone actually use emacs? I've never used it a day in my life, and don't know anyone who actually does use it.

/ducks

I use emacs.  It's a pain in the a** to set up (google is my friend).  But once you've got it set up, it's great.

No need to duck.  smile

emerge-files command in emacs actually makes for pretty easy-mode pacnew handling.

Offline

#14 2008-03-18 15:20:33

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Safe way to edit system configuration files?

I've been using vimdiff for that. Emacs sounds like it has a pretty steep learning curve. It's also a very large program. 31MB for a command line editor!

Offline

#15 2008-03-18 16:06:24

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Safe way to edit system configuration files?

Misfit138 wrote:

I've been using vimdiff for that. Emacs sounds like it has a pretty steep learning curve. It's also a very large program. 31MB for a command line editor!

That's the thing, it's not a command line editor, it's a full graphical OS.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#16 2008-03-18 16:26:00

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: Safe way to edit system configuration files?

emacs kungfu.divx

It's just missing a codec!


I need real, proper pen and paper for this.

Offline

#17 2008-03-18 17:53:52

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: Safe way to edit system configuration files?

shining wrote:

That's the thing, it's not a command line editor, it's a full graphical OS.

Agreed! Emacs is one step too far... Soon, it'll combine the functions of Firefox, ePDFview, Mplayer, GIMP and MPD all into one. You'll never need another program again!

It'll also do your weekly shopping as a cronjob


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#18 2008-03-18 18:07:30

eerok
Member
From: Canada
Registered: 2005-03-20
Posts: 171

Re: Safe way to edit system configuration files?

I liked Emacs a lot back when I liked Emacs.  Now I like Vim a lot big_smile

The size of Emacs is hardly relevant anymore, is it?  We have huge RAM and disk capacity now.  It's also not such a bad thing to put up Emacs and just stay there for your coding, mail, news, etc.  Think of it as a suite ... and smaller than OpenOffice ...

But if you don't code, I'd say Emacs isn't worth the bother.


noobus in perpetuus

Offline

#19 2008-03-18 18:27:34

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: Safe way to edit system configuration files?

eerok wrote:

But if you don't code, I'd say Emacs isn't worth the bother.

In fact, if you've heard of vim, emacs isn't worth the bother.

i've taken this joke too far, right? big_smile


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#20 2008-03-18 19:43:54

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Safe way to edit system configuration files?

This isn't a text editor holy war threads. We don't have those at Arch. Vim and emacs are incomparable, they're very very different tools that happen to be used for similar things. They tend to be oriented toward two different sorts of people.

For the most part, it seems like the sort of people that prefer Arch are the sort of people that prefer Vim, but this isn't a hard and fast rule. Some of us prefer to write our own editors for example. :-D

Dusty

Offline

Board footer

Powered by FluxBB