1

I'm trying to mount an external drive on a web folder, call it flash: enter image description here

After mounting the external drive which is located in /dev/sdb1 the permissions change like this:

sudo mount -o defaults /dev/sdb1 /var/www/html/TV/flash

enter image description here

When I try to browse a file from the mounted location, I get 404 Not Found while the file exists.

enter image description here

When I try to list files inside the folder it says Permission Denied

enter image description here

Also, I have tried changing the ownership of the folder, but didn't work:

sudo chown -R "$USER":www-data flash/

chown: changing ownership of 'flash/System Volume Information': Read-only file system

chown: changing ownership of 'flash/': Read-only file system

2

1 Answer 1

0

There is a difference between folder folder\

folder\ means things inside the folder not the folder itself. folder indicates the folder only not the files and sub-directory residing inside it. But as you're using the chown command recursively ownership of all sub-directory and file inside folder will also be changed.

So typing the following shall solve the situation

sudo chown -R "$USER":www-data /var/www/html/TV/flash

Also change files permission. Your're making $USER as owner and www-data as group owner. And your existing permission showing 500 for the directory. So only owner and not the group owner can search through the directory. and your we server is running under the group owner www-data

A good practice is keeping all directory permission as 755 and files permission as 644.

find /var/www/html/TV/flash -type d -exec chmod 755 {} \;
find /var/www/html/TV/flash -type f -exec chmod 644 {} \;

Comment in case of any error.

2
  • I get the same error. Read-only file system
    – Maysam
    Nov 21, 2017 at 20:24
  • Ok. You may try this once sudo mount -o remount,rw /dev/sdb1 /var/www/html/TV/flash after un mounting the already mounted one.
    – Abhik Bose
    Nov 21, 2017 at 20:54

You must log in to answer this question.

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