The moose likes Linux / UNIX and the fly likes Ubuntu and apache ...index.html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Ubuntu and apache ...index.html" Watch "Ubuntu and apache ...index.html" New topic

Ubuntu and apache ...index.html

Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
ok i installed php5 and apache2 with the following:

sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install apache2-mod-php5

but when i go into my var/www directory when i try to edit my
index.html file, its says its readonly, and can't be modified.

how can i fix this?

Justin Fox

You down with OOP? Yeah you know me!
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
You must first alter the privileges over the file.

First, you must know what is the password of the root account. If you do not know the password of the root account you can change it with

$ passwd root

And after resetting a new password, you can invoke the chmod command to grant yourself privileges over the file.

$ chmod a+rw index.html

Hope that helps!
[ October 25, 2007: Message edited by: Edwin Dalorzo ]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Unix - including Linux and Solaris - is a fairly secure OS. In the stock Linux distros, Apache runs as a special user - usually it's something like "apache".

So if you do an 'ls -l /var/www/index.html', you'll see who owns it and what rights are available.

For maximum security, it's best to either do editing either under the account of the apache user or as a member of the apache group (assuming that the pages are group-writable). If you open it up to everyone (chmod 777), then there's a chance that someday someone may come in and do Bad Things.

An IDE is no substitute for an Intelligent Developer.
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
thanks for the replies, the logging in under root will probably help.
I didnt know the password, or know how to get/change it, but now I do.


I agree. Here's the link:
subject: Ubuntu and apache ...index.html
jQuery in Action, 3rd edition