[X Newbies] Can't save to etc directory

Scott j-scotty at attbi.com
Mon Dec 9 22:30:53 PST 2002


On Wednesday, December 18, 2002, at 11:20 AM, Cybersmith wrote:

> Hi Folks,
> I really am a newbie running 10.2.2, and I need some assistance with 
> both
> the terminal and Apache. I am attempting to configure my httpd.conf 
> file on
> Apache but the system will not allow me to save any file in the /etc/
> directory. I am able to save a copy of the file elsewhere on my drive.
> I presume that the reason I cannot save to the etc directory is that 
> the
> user under which I have logged in does not have write privileges for 
> that
> directory.
> I only have two users both of which are admin users, and neither of 
> them
> will allow me to make changes to this file.
> What can I do to solve this situation?
>
> Many thanks,
> Gary English
>
>

Gary,
I assume since you mention terminal that you are using either vi, pico, 
or emacs to edit httpd.conf.
Only root can edit this file. Root is disabled by default, but you can 
get around this on a single command basis by using "sudo".

sudo   vi   /etc/httpd.conf

Replace "vi" with your editor of choice. This will ask you to enter 
your admin user passwd, then run 'vi' as root. You'll then be able to 
save the file.

In general, you can preface with sudo any command which you normally 
don't have permissions to run.

Be careful w/ sudo, as you can do just about anything you want to. If 
you insert a space or make the wrong typo in a sudo command, you can 
also do just about anything you didn't want to do. (I learned this the 
hard way, after many years of command-line experience, by putting in an 
extra space and wiping out the entire contents of /etc. I knew better, 
but was careless. )

If you need to run multiple commands, all as root, you can use sudo to 
become root, without having to enable root:
sudo su -
will allow you to become root, in the current terminal window, until 
you close the window, or type 'exit'.
This is more dangerous, because it is easy to forget you are root. Yes, 
I've learned this one the hard way too. That's why I use sudo one 
command at a time now.


-- 
Scott



More information about the X-Newbies mailing list