0

I have owncloud running in Ubuntu server I have enabled external storage pointing to second hard drive in my machine and added a local storage

I can see the folder in owncloud but when I click on it I can see anything, empty

I need to fix the permissions (OC needs read and write permissions for www-data)

Run this command

sudo -u www-data ls -la /media/Test/Share/

I get

ls: cannot access /media/Test/Share/: Permission denied

How can I fix the permissions?

Carlos
  • 41
  • 2
  • 3
  • 9

1 Answers1

3

To change the owner of a file (or folder) you use chown (ChangeOwner). You can specify a user and a group as owner. As in,

chown option user:group file/folder

In the situation you a describing, you could try the following, only change the group to www-data, so that the original owner isn't affected.

chown -R :www-data /media/Test/Share

Please notice the : before www-data...

To change the user and group owner of the folder,

chown -R www-data:www-data /media/Test/Share

-R option is used for "Recursive", it will also change the user & group of the folders contents (as in, any other directory or file that it holds).

Also check this other answer, change-folder-permissions-and-ownership

This should do it.

Still, if the user or group don't have sufficient rights yet (read/write) you can use the chmod command for it.

I'll start with the warning...

Please, do not use the value 777 unless you know exactly what you are doing. Even then you should be wondering if it's worth it ;)

Read the following please: Why shouldn't /var/www have chmod 777

For instance, to give current user&group read/write rights on a file, but others none,

chmod 660 filename

See this article for more information on the values and a better explanation then I can give,

https://mdshaonimran.wordpress.com/2010/06/13/chmod-change-filefolder-permission-in-ubuntu/

Sinn3d
  • 189