• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Write to microSD with LAMP (www-data)  (Read 1549 times)
tronpaul
Newbie
*

Karma: 0
Posts: 1


View Profile
« on: December 11, 2010, 05:07:05 PM »

I'm trying to allow my website to write to a microSD card I have inserted into my Guruplug.  I can write to the card as root, but www-data cannot write to anything on the usb even though I have run chmod 777 on the folder I want it to write to.  If I try to change the ownership of the folder to www-data I get "operation not permitted".  The website can write to the onboard flash in folders other than /var/www, but I'm not sure why I can't write to my microSD card.  Any ideas?
Logged

smannem
Newbie
*

Karma: 0
Posts: 3


View Profile
« Reply #1 on: December 12, 2010, 01:17:40 AM »

I have a normal SD card inserted.
It was auto-mounted on /media/usb0.
What I did was:
    sudo mkdir /media/usb0/test
    sudo chmod 777 /media/usb0/test

The command 'sudo -u www-data touch /media/usb0/test/test' gives the following error:
   touch: cannot touch `/media/usb0/test/test': Permission denied

So I think I have the same issue as you have.
The command 'mount' tells: about this mount:
    /dev/sdb1 on /media/usb0 type vfat (rw,noexec,nodev,sync,noatime)

The command 'ls -alth /media/usb0/test/' tells me:
    total 32K
    drwxr-xr-x 2 root root 16K 2010-12-12 07:38 .
    drwxr-xr-x 4 root root 16K 2010-12-12 07:38 ..
So chmod did not change permissions.

I experienced this behaviour in the past and if I remember correctly,
the thing is that vfat is designed for Windows permissions.
And linux permissions and Windows permissions quite different.
Therefore setting Linux permissions on a vfat mount (sub path) does not work.
What you can do is set linux permissions and ownership for the whole tree.
You can specify this in your mount command (not with automount, I guess).
check 'man mount' for more info.
Or you might change to a linux filesystem such as ext2

I'm not a Linux guru myselve, but I hope I helped you in the right direction.
Greetz Smiley
Logged

Pages: [1]
Print
Jump to: