Forum Home
Press F1
 
Thread ID: 69372 2006-05-30 09:14:00 Linux permissions problem Greven (91) Press F1
Post ID Timestamp Content User
459135 2006-05-30 09:14:00 I've got apache set up on my ubuntu box, with the document root as /var/www.
I want to be able to play round with all my web stuff from my usual user account, so I changed the permissions to ones that should let me do that. Problem is, it isn't working.

I changed the /var/www directory premissions from root:root rwxr-xr-x to root:www-data rwxrwxr-x and added myself to the www-data group.

what have I overlooked? I thought that should be enough, but it gives me a permission denied error when I try to create a new folder.
Greven (91)
459136 2006-05-30 10:17:00 Are you sure the document root isn't /var/www/html? Also you need to make the permission changes recursive so that they apply to each level along the path otherwise a higher level will block you. johnd (85)
459137 2006-05-30 10:32:00 Are you sure the document root isn't /var/www/html?
It is /var/www on my system. I've created a subfolder as root then changed the owner to me so that I can work with it, but I still want to know what is wrong with the origional method.
Greven (91)
459138 2006-05-30 12:05:00 root:root rwxr-xr-x to root:www-data

I think thats your problem, the folder owner is still root. You have chgrp the folder but havn't chown'd to a user other than root.
superuser (7693)
459139 2006-05-30 14:45:00 You'll need to chmod the folder to 775 although I think you'll be better off creating your own user directory and using that, than using the default /var/www.

Also document_root is /var/www/html which is where you'll store your web pages, /var/www/cgi-bin/ is where your cgi-scripts go.

If you want to create your own User Directory instead of using the default I have a few tutorials I wrote for Fedora.

I'll just basically outline what you should do under your own user:


mkdir $HOME/public_html
chmod 701 $HOME
chmod 705 $HOME/public_html

Next as root we need to alter our httpd.conf file. You can use another editor instead of "vi" if you like.


su -c "vi /etc/httpd/conf/httpd.conf"

Inside of it we need to alter <IfModule mod_userdir.c> section to have:


UserDir "disabled"
UserDir enabled your_user_name
UserDir public_html

And then at the very end of this config file we add:


<Directory "/home/*/public_html">
Options Indexes SymLinksIfOwnerMatch IncludesNoExec
AllowOverride FileInfo AuthConfig Limit
</Directory>

Then save the file, restart apache:


su -c "/sbin/server httpd restart"

And you should be now able to access your own User Directory by:


localhost

Since there's no index.(php|html) there, it'll probably just display an empty directory listing. If you need cgi-bin also, I can show you how to do that.

Cheers,

KK
Kame (312)
1