1

I have an Apache based web site and am trying to allow the user to upload files to a drop box on one machine and then have them transferred to another. So I form a group for two users: www-data which is the Apache web user and OtagoHarbour which has a key to transfer files from one machine to another.

The existence of the group and its members is confirmed thus.

OtagoHarbour@WebServer:/var/www$ egrep -i "www-OtagoHarbour" /etc/group
www-OtagoHarbour:x:1002:OtagoHarbour,www-data

However, this does not appear to give OtagoHarbour group permissions to a group owned by www-data.

OtagoHarbour@WebServer:/var/www$ sudo ls -ld dropbox
drwx-wx-wx 2 www-data root 4096 2014-01-20 23:25 dropbox
OtagoHarbour@WebServer:/var/www$ sudo chmod g+r dropbox
OtagoHarbour@WebServer:/var/www$ sudo ls -ld dropbox
drwxrwx-wx 2 www-data root 4096 2014-01-20 23:25 dropbox
OtagoHarbour@WebServer:/var/www$ scp /var/www/dropbox/*.cel 192.168.1.6:/var/www/dropbox
/var/www/dropbox/*.cel: No such file or directory
OtagoHarbour@WebServer:/var/www$ sudo chmod o+r dropbox
OtagoHarbour@WebServer:/var/www$ scp /var/www/dropbox/*.cel 192.168.1.6:/var/www/dropbox
whatever1.cel                    100%   11MB  11.3MB/s  00:01    
whatever2.cel                    100%   11MB  11.2MB/s  00:01    
whatever3.cel                    100%   11MB  11.2MB/s  00:01  

So, despite www-data and OtagoHarbour being in the same group, g+r does not appear to give OtagoHarbour read access to a group owned by www-data (but o+r does).

Update

OtagoHarbour@WebServer:/var/www$ sudo chgrp -R www-OtagoHarbour /var/www/dropbox
OtagoHarbour@WebServer:/var/www$ sudo chmod o-r dropbox
OtagoHarbour@WebServer:/var/www$ sudo chmod g+r dropbox
OtagoHarbour@WebServer:/var/www$ scp /var/www/dropbox/*.cel 192.168.1.6:/var/www/dropbox
/var/www/dropbox/*.cel: No such file or directory

Update 2

OtagoHarbour@WebServer:/var/www$ ld
ld: no input files
OtagoHarbour@WebServer:/var/www$ ls -l /var/www/dropbox/*.cel
ls: cannot access /var/www/dropbox/*.cel: No such file or directory
OtagoHarbour@WebServer:/var/www$ ls -l /var/www/dropbox
ls: cannot open directory /var/www/dropbox: Permission denied
OtagoHarbour@WebServer:/var/www$ 
3
  • Can you have your OtagoHarbour user run the groups command to make sure its group list includes www-OtagoHarbour? Group membership is set only by programs like login or su. A shell process (and any ordinary process spawned from it) that was created prior to /etc/group being updated won't have its groups changed. Commented Jan 22, 2014 at 15:33
  • @Mark. Sorry about my slow reply. The groups command showed both OtagoHarbour and www-data. Thanks, Commented Jan 23, 2014 at 3:28
  • The problem is now fixed as outlined below. Thanks again, Commented Jan 23, 2014 at 4:13

1 Answer 1

3

Users OtagoHarbour and www-data belong to www-OtagoHarbour group but dropbox directory isn't associated to www-OtagoHarbour group but to root.

Running command

sudo chgrp -R www-OtagoHarbour /var/www/dropbox

should fix the problem. With this change you don't need to keep the directory world readable.

4
  • Thank you for the reply but I am still having problems as I have shown in the update above. Thanks, Commented Jan 22, 2014 at 14:27
  • @OtagoHarbour Can you run the following commands as OtagoHarbour user and post the output here: 'id', 'ls -l /var/www/dropbox/*.cel' and 'ls -l /var/www/dropbox'
    – Pasi H
    Commented Jan 22, 2014 at 16:17
  • Sorry about the delay. I have added the results in update 2 above. Thanks, Commented Jan 23, 2014 at 3:19
  • It's working now. Not sure exactly what fixed it. I entered 'newgrp www-OtagoHarbour' then 'egrep -i "www-OtagoHarbour" /etc/group' returned 'www-OtagoHarbour:x:1002:OtagoHarbour,www-data' then I enetered what you suggested and now it works. Commented Jan 23, 2014 at 4:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .