Score:1

Apache unable to write to NTFS automounted drive

cn flag

I've a main ssd drive where os is installed
I have also a second drive (NTFS auto-mounted) where all www is hosted

All was working fine and Apache could load/write/etc. files into this NTFS partition

I had to erase/format my main drive and reinstall everything
Now Apache can't write files into that partition

I've restored from a backup the apache2 config, envvars, fstab, etc.

fstab:

UUID=587AA3687AA3421C  /media/datos   ntfs-3g   defaults,nls=utf8,umask=000,dmask=027,fmask=137,uid=1000,gid=1000,windows_names 0 0

apache2.conf:

<Directory /media/datos/html/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

apache2/envvars:

export APACHE_RUN_USER=kike
export APACHE_RUN_GROUP=kike

virtualhost.conf (it is a codeigniter 4 php app):

<VirtualHost *:80>
    ServerAdmin admin@localhost
    ServerName misite
    ServerAlias misite
    DocumentRoot /media/datos/html/misite/public   
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
    SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key    
    <Directory /media/datos/html/misite/public>
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error_misite.log
    CustomLog ${APACHE_LOG_DIR}/access_misite.log combined
</VirtualHost>

PS:
- www-data is added into group kike (my user/group)
- PHP is installed as FPM service

I've tried also this in fstab (w/o success):

UUID=587AA3687AA3421C  /media/datos   ntfs-3g   user,auto,exec,nodev,nosuid,async,rw,nls=utf8,umask=000,dmask=027,fmask=137,uid=1000,gid=1000,windows_names 0 0

UUID=587AA3687AA3421C /media/datos ntfs-3g uid=kike,gid=kike,nls=utf8,umask=007,windows_names 0 0

My user (kike) does not have problem in handling files/folders from this NTFS partition, but I wonder why this was working previously and now it doesn't

Thanks for any tip you can give me

Raffa avatar
jp flag
Partly related: [How can web server access external-hdd?](https://askubuntu.com/q/1220778)
Score:0
cn flag

While wondering what was different from previous installation, I noticed (then edited the question) that this time I installed php 8-1 fpm, so I begun searching about this and found the following

If I edit the following file

sudo nano /etc/php/8.1/fpm/pool.d/www.conf

and then change the following variables to my username (instead www-data)

user = kike  
group = kike  
listen.owner = kike 
listen.group = kike

then save changes, restart apache2 and php8.1-fpm services

Then it works fine

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.