LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cannot read/write to /var/www (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-read-write-to-var-www-142247/)

eddi 02-04-2004 12:38 PM

cannot read/write to /var/www
 
Hi,

I have samba running quite nicely, and i have a few folders that i can access from my XP machine aswell as being able to move files to and from.

However this is not the case with the webserver directory /var/www , i can open it, but i cannot not move my web development work over to it.

I've had ago at permissions with the chmod and gave 777, and that seem the only way it will work, which is not great. The other samba folders are set on 655, so why does this not work for 'www' folder? :confused:


Cheers

ricstirato 02-04-2004 03:08 PM

The default owner of /var/www is root, and you probably don't connect as root.

If you are single user, do

chown -R <username> /var/www

The user will then be owner of /var/www and all it's contents. In this case mode 755 (for directories) and 644 (for files) will do.


If there are more users that should have write access, create a group and assign it to /var/www:

groupadd wwwedit
chgrp -R wwwedit /var/www

Add all relevant users to the group, e.g. by editing /etc/group (put a comma separated list of users at the end of the group's line) or use your distro's GUI tool to do so.

In this case, the group must have write access:

chmod -R g+w /var/www

You should also force the group for all new files under /var/www:

chmod 2775 /var/www
cd /var/www
chmod 2775 `find -type d`


To avoid permission problems, the users should have a umask of 002 when they come in via console. Default is 022. You can change this (distro-dependant) by editing these user's ~/.bashrc

If you use Samba to access /var/www, set modes 775 and 664 for directories and files respectively for the www-Share in smb.conf.


An alternative is to use the user's "public_html" directory in their home directories, have a look at Apache's httpd.conf.
In this case the web pages can be accessed in the form

http://<servername>/~<username>/

Permissions for /home/<user> and /home/<user>/public_html must be set to (at least) 701 for this to work.


All times are GMT -5. The time now is 12:19 PM.