Can't edit the nagios.cfg file

I installed nagios for the first time and im trying to edit the nagios.cfg file but it is read only and won’t let me. How do i edit it or get rid of the swap file?

sorry i am new to linux and nagios

thanks in advance

It depends on what distro you are on. You probably need to use sudo or switch to root.

distro of nagios or suse?

is there a way to save .cfg file from a command line?

it sounds like you aren’t root.

do the following…(omit the prompt obviously)

you@suse:~>su
Password: (enter your root password here)
root@suse:~>vi nagios.cfg

You obviously need to be in the directory where nagios.cfg is prior to calling vi.

As far as saving from the command line… Do you mean in vi? If so, after you make your edits to an existing file you:

ESC
:w

To quit:

:q

Hope that helps.

thanks highpointe,
ultimatly i ended up using “chmod og+rw *.cfg” and later realizing that i never restarted when i added myself to the root group. I know im a beginner to linux but come on, i should of did that first thing lol :slight_smile: thank you very much for your help