Ubuntu 8.10 / Apache2 permissions issue (1 Viewer)

Beast

Former Camp Beast
Joined
Nov 6, 2001
Messages
13,890
Reaction score
3,550
Location
Parts Unknown
Offline
Ok, I feel like a total linux noob (which I'm not), but I'm having issues being able to create files in /var/www/..

I installed the LAMP stack via 'tasksel' which installed Apache2, PHP, and MySQL.. Apache is running as 'www-data', and I've set /var/www as the 'www-data' home directory.. It is owned by 'www-data' with the default group as 'www-data'.. I've given group write permissions to /var/www and every directory below it (chmod -R 775 /var/www)..

I've added my username ('bryan') to the 'www-data' group, so in theory, I should be able to create files in /var/www/.. But I can't..

Anyone think of a reason why this isn't working?

Code:
bryan@beast:/var/www$ groups bryan
bryan www-data
bryan@beast:/var/www$ ls -al
total 16
drwxrwxr-x  3 www-data www-data 4096 2009-02-15 22:34 .
drwxr-xr-x 16 root     root     4096 2009-02-16 14:03 ..
drwxrwxr-x  9 www-data www-data 4096 2009-02-15 22:44 htdocs
-rwxrwxr-x  1 www-data www-data   45 2009-02-15 22:24 index.html
bryan@beast:/var/www$
 
When you say "and I've set /var/www as the 'www-data' home directory" you mean that you have the DocumentRoot as /var/www in your /etc/apache2/sites-available/default file, correct?

I prefer to just use `sudo` in front of commands when mucking with my /var/www directory on my vanity servers. When I check the groups that my default user belongs to it is a bit lengthier than yours:

Code:
$ groups ken
ken adm dialout fax cdrom floppy tape audio dip video plugdev scanner netdev lpadmin powerdev admin fuse vboxusers mythtv sambashare

Nope. That point is irrelevant. I can't touch files as 'ken' in /var/www either.

What is your default umask set to? This is set by default for all users in /etc/profile (on 8.10) and can be controlled per user in their ~/.bash_profile. Setting it to 022 may be helpful in the future anyway.

Lastly, did the LAMP stack set the DocumentRoot to /var/www or /var/www/htdocs? Have you tried creating anything inside of /var/www/htdocs?

What are the permissions of www?

Code:
cd /var && ls -lh
 
When you say "and I've set /var/www as the 'www-data' home directory" you mean that you have the DocumentRoot as /var/www in your /etc/apache2/sites-available/default file, correct?

/var/www/htdocs/ is the DocumentRoot, but user www-data's home directory as specified in /etc/passwd is /var/www/..

I prefer to just use `sudo` in front of commands when mucking with my /var/www directory on my vanity servers. When I check the groups that my default user belongs to it is a bit lengthier than yours:

Code:
$ groups ken
ken adm dialout fax cdrom floppy tape audio dip video plugdev scanner netdev lpadmin powerdev admin fuse vboxusers mythtv sambashare

Nope. That point is irrelevant. I can't touch files as 'ken' in /var/www either.

I could do that, but I figured I would just use an unprivileged user and have group permissions such that I could create files as myself.. Then I could just chown/chmod whatever I've done.. Trying to do as little as root as possible.. :)

What is your default umask set to? This is set by default for all users in /etc/profile (on 8.10) and can be controlled per user in their ~/.bash_profile. Setting it to 022 may be helpful in the future anyway.

Yep, 022 is the default..

Lastly, did the LAMP stack set the DocumentRoot to /var/www or /var/www/htdocs? Have you tried creating anything inside of /var/www/htdocs?

What are the permissions of www?

Code:
cd /var && ls -lh

The LAMP stack set it to /var/www.. I dropped in my htdocs directory from a previous system and modified the Apache config to point to it instead..

The permissions on /var/www/ are 775 as well..

Last night I shut my system down.. The first time I start it up tonight and try creating a file as myself in /var/www/, it works.. Now, beforehand I did go into /etc/passwd and set www-data's shell to /sbin/nologin as an additional security precaution, but I wouldn't think that that would have any effect on this issue.. So it seems my permissions are working correctly now.. :shrug:
 
That is weird that it works now. I wonder if you had re-sourced your .bashrc if that would have done the trick? I can't see what would change on a reboot to make it work. Oh well. Ubuntu's not Debian: that's for **** sure.

Glad to hear it is working. I was worried that my Frankenstein install wouldn't be too much help. I converted from Debian Unstable to Warty Warthog ages ago and have plenty of cruft left over on this box. If I would ever port all of my images in my gallery2 install to somewhere safe, I'd just reinstall a clean version.

And dude: that sig-pic is ******* allsome.
 
That is weird that it works now. I wonder if you had re-sourced your .bashrc if that would have done the trick? I can't see what would change on a reboot to make it work. Oh well. Ubuntu's not Debian: that's for **** sure.

Glad to hear it is working. I was worried that my Frankenstein install wouldn't be too much help. I converted from Debian Unstable to Warty Warthog ages ago and have plenty of cruft left over on this box. If I would ever port all of my images in my gallery2 install to somewhere safe, I'd just reinstall a clean version.

And dude: that sig-pic is ******* allsome.

Well, I kept hearing about people installing Ubuntu, and I've already had experience (although limited as far as administration) with RedHat ES and Fedora, SuSE, unicos/lc (SuSE derivative on Cray XT systems also known as the Cray Linux Environment), so I thought I'd check Ubuntu out..

Thanks on the sig pic.. Just did a Google Image Search for Deuce and that one was on one of the first pages..
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Users who are viewing this thread

    Back
    Top Bottom