Question about FTP/Apache

Discussion in 'Server Operation' started by Jamesk5, Feb 9, 2007.

  1. Jamesk5

    Jamesk5 New Member

    I'm just wondering how I need to go about letting both Apache and FTP system users have read and write access to some of my virtual host directories. I followed Falko's proftpd tutorial to setup proftpd with a mysql backend.
    However, since I'm running wordpress (and I use it to upload alot of files) on a few different VHosts, I need to allow for access to the files by both apache and proftpd.

    Thanks :)
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    There are several possibilities:

    1) create a group for each vhost, make all files group writable and make sure that all users that shall be able to write files are members of this group.

    2) Use SuPHP to run your PHP scripts under the same user that you use for FTP.
     
  3. Jamesk5

    Jamesk5 New Member


    I've tried this - but it doesn't *seem* to be working. My FTP client is giving me permission errors saying it can't delete the file.
     
  4. falko

    falko Super Moderator ISPConfig Developer

    I guess the file was created by your Apache user?
    The solution would be what Till posted under point 2.
     
  5. Jamesk5

    Jamesk5 New Member

    But if the group has read/write permissions on the file wouldn't *any* member of that group also be able to delete that file??
     
  6. falko

    falko Super Moderator ISPConfig Developer

    Yes, that's right.
     
  7. Jamesk5

    Jamesk5 New Member

    If that's right, why isn't it working in my case? :p
    I can't delete files created by another user of the same group as my ftp user, using my FTP client.
     
  8. martinfst

    martinfst ISPConfig Developer ISPConfig Developer

    To delete a file, the group must have write rights on the directory. So 775 and the same group in the above directory level.
     
  9. Jamesk5

    Jamesk5 New Member

    I realise that, all the folders/files have the 775 and correct group applied through a chmod -R and chown -R
     
  10. martinfst

    martinfst ISPConfig Developer ISPConfig Developer

    then it should work:confused:
     
  11. Jamesk5

    Jamesk5 New Member

    Here's a bunch of data that might help someone help me with my problem!!

    Entry for stfaiths group in /etc/groups:
    Code:
    stfaiths:x:2004:www-data,ftpuser
    ls -l on /var/www/virtual/stfaiths (directory that I'm trying to get to work with both apache2 and proftpd):
    Code:
    drwxrwxr-x 5 www-data stfaiths    4096 2007-01-27 13:18 dev
    drwxrwxr-x 6 www-data stfaiths    4096 2007-01-26 23:08 dev.bak
    drwxrwxr-x 5 www-data stfaiths    4096 2007-01-27 19:01 dev.youth
    -rwxrwxr-x 1 www-data stfaiths 1121622 2007-02-25 19:59 devyouth.zip
    drwxrwxr-x 3 www-data stfaiths    4096 2007-02-25 19:47 __MACOSX
    drwxrwxr-x 5 www-data stfaiths    4096 2007-01-27 13:06 www
    drwxrwxr-x 6 www-data stfaiths    4096 2007-01-27 13:03 www.bak

    Output of a ps -ef | grep ftp (while a connection to the server is active):
    Code:
    ftpuser  16447     1  0 14:24 ?        00:00:00 proftpd: (accepting connections)      
    ftpuser  22057 16447  0 15:31 ?        00:00:00 proftpd: stfaiths.org.au - udsl-6-137.NSW.dft.com.au: LIST -a
    james    22069 14262  0 15:31 pts/0    00:00:00 grep ftp

    I don't know if that will help anyone, but I hope I can get this problem resolved. If you think any more info will help you, let me know!
     
  12. falko

    falko Super Moderator ISPConfig Developer

    Please post the output of
    Code:
    ls -la /var/www/virtual/stfaiths
     
  13. Jamesk5

    Jamesk5 New Member

    ls -la on /var/www/virtual/stfaiths.org.au (that's the directory.. not just stfaiths like I posted above)
    Code:
    drwxrwxr-x 8 www-data stfaiths    4096 2007-02-25 20:01 .
    drwxr-xr-x 8 nobody   nogroup     4096 2007-02-16 14:37 ..
    drwxrwxr-x 5 www-data stfaiths    4096 2007-01-27 13:18 dev
    drwxrwxr-x 6 www-data stfaiths    4096 2007-01-26 23:08 dev.bak
    drwxrwxr-x 5 www-data stfaiths    4096 2007-01-27 19:01 dev.youth
    -rwxrwxr-x 1 www-data stfaiths 1121622 2007-02-25 19:59 devyouth.zip
    drwxrwxr-x 3 www-data stfaiths    4096 2007-02-25 19:47 __MACOSX
    drwxrwxr-x 5 www-data stfaiths    4096 2007-01-27 13:06 www
    drwxrwxr-x 6 www-data stfaiths    4096 2007-01-27 13:03 www.bak
    
     
  14. falko

    falko Super Moderator ISPConfig Developer

    Looks ok, too. :confused:
     
  15. Jamesk5

    Jamesk5 New Member


    Ahh, that's no good! I'm wondering if it's Debian doing something weird??

    I'm planning on rebuilding the whole machine soon (I'm registering a domain name so the box will have a proper hostname), so perhaps a rebuild with a more recent version of Debian will fix the problem. I'm only running Debian Etch (Unstable).

    Anyone else got any suggestions?? Perhaps something wrong with my FTP DB setup?
     
  16. Jamesk5

    Jamesk5 New Member

    I've moved to Debian Etch (Stable) [some of you will already know this] and still no resolution.
    How Secure is suPHP? Security is obviously pretty important, especially when running multiple sites.
     
  17. falko

    falko Super Moderator ISPConfig Developer

    Pretty secure, I'd say.
     
  18. fr0m_heaven

    fr0m_heaven New Member


    check for the sticky bit attributes of the files ..
    do ls -a
    if see
    " trwxrw_r_ " check outy for the " t " bit .......

     
  19. fr0m_heaven

    fr0m_heaven New Member

    sticky

    check out for the sticky bits

    " trwxrw_r_ _ " if this is what u see ... u need to work around ..
     
  20. Jamesk5

    Jamesk5 New Member

    You can see from my postings above that I'm not getting a 't' in my listings via ls.

    Also, you should have asked me to type ls -l not ls -a
     

Share This Page