owncloud cannot access directory - bash

I am running Raspbian version 7 on my raspberry pi. I am running owncloud on this. I have mounted an external drive under /media/Owncloud. This is where I have owncloud store all the files. I cannot access this directory. When I try cd /media/Owncloud it gives me the following error:
-bash: cd: /media/Owncloud/: Permission denied
How can I access this directory?

OwnCloud and external hard drives are tricky and you have a permission issue. For some reason, trying to make a link to an external hard drive has issues, so you need to try mounting your external hard drive.
External hard drive - Apply the proper group and read permissions:
chown -R www-data:www-data /media/user/your_hard_drive/owncloud_data/
chmod -R 777 /media/user/your_hard_drive/owncloud_data/
Local hard drive - Apply the proper group and read permissions:
mkdir /var/www/owncloud/data
chown -R www-data:www-data /var/www/owncloud/data
chmod -R 777 /var/www/owncloud/data
Make the mount of local hard drive to external hard drive
mount --bind /media/user/your_hard_drive/owncloud_data/ /var/www/owncloud/data/
Source:
https://manandkeyboard.wordpress.com/2014/09/15/owncloud-and-an-external-hard-drive/

If you just want to cd into the directory, change to root with sudo -i.

In order to access /media/Owncloud, you need to set the proper permissions. Run the command sudo chmod 755 /media/Owncloud(for more security relative to permission 777).
You also may need to allow to webserver to access the directory. In order to do that, run sudo chown -R www-data:www-data /media/Owncloud
Sources:
My own experience and frusteration in running into the exact same problem
http://www.instructables.com/id/Raspberry-Pi-Owncloud-dropbox-clone/?ALLSTEPS A great albeit somewhat outdated guide to set up owncloud on a Raspberry Pi.

The issue is with wrong permissions.
If the webserver runs as user www-data, the mounted folder must be somehow accessible to that user
either that user must be owner of mounted folder and its contents, and have the "user" permissions, or
the the folder must be accessible to the group the webserver user is in (usually www-data).
To see the current permissions use the ls -l command.
To change the owner use chown command,
to change the permissions for the user-owner, and group-owner, use the chmod command,
or just use Midnight commander (mc) or some GUI to do that.
If you are mounting the external volume through /etc/fstab check the options in there. I would not recommend using the volume with some dynamic mounting (like the file managers do (gvfs-fuse)) if is a key folder for a webserver with ownCloud and you need to have it auto-mounted on boot, as some specific user that the webserver is run as.
I have an experience with having the ownCloud data folder on /srv/data (also ownCloud 7.0 on Ubuntu Server 14.04 VPS), the permissions are 770 and the owner is www-data:www-data, and in the ownCloud config file, I use the line
'datadirectory' => '/srv/data',
I would not recommend using 777 permissions, as it is not a good security practice in general.

Related

How to solve the problem of accessing the storage in Laravel folder

Faced a problem accessing the storage folder. A symbolic link was created, but when I try to access any file in the storage folder, I get an error 403 "You do not have permission to access this object. The file is not readable, or the server cannot read it." I have a second project on a local machine, everything works fine there. I tried to give 777 permissions to the storage folder, but this causes the "Permisson denied" error. I will be glad to any help!
Macos catalina
Laravel Permissions
first change ownership of the laravel directory to our web group.
sudo chown -R :www-data /var/www/laravel
Next we need to give the web group write privileges over our storage directory so it can write to this folder.
sudo chmod -R 775 /var/www/laravel/storage
where laravel is the name of the root

Raspberry pi web server

I've been trying to set up my own web server with the raspberry pi3 b+ and it was going good so far i could made a ddns and access it from any other wifi or anything, the only problem was that i couldn't change the default "Debian apache" site.
I googled a lot about it and everybody said that all i have to do is change the root directory /var/www/to my directory but i just couldn't save the files, as it asked me if I wanna overwrite it - I pressed yes but it told me that I don't have permission for that I also couldn't overwrite the index.html file that was in the default folder. Is there anything I can do about it?
I had the same problem while doing this myself. You need to open terminal from the Raspberry Pi, or SSH. You need to change the folder type to 755, which allows the user to read,write,execute. Make sure that the directory you do this to is the /var/www/html folder.
All you need to do is type:
chmod -R 755 (dir)
dir = directory of the file.
If you'd like to change a file, such as the default index.html file in there, use 744 instead of 755.
After this, if you want to start the server, just type in
sudo service apache2 start
Here's a link for how to install the apache2 package.
https://pimylifeup.com/raspberry-pi-web-server/

Work with app/console in Symfony at Mac OS X

I've installed Symfony on Mac Os X and do:
chmod -R 777 app/cache app/log
Try do this:
php app/console cache:clear
And get back error:
[RuntimeException]
Unable to write in the "/Users/anton/Sites/local/Symfony/app/cache/dev" directory
Try to fix it! Thanks!
If you are on Mac you can use ACL as it is explained here.
From the project directory:
sudo chmod +a "_www allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
sudo chmod +a "whoami allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
_www in the first line is the name of which is running the web server
You have to change whoami in the second line as it is you when you type php app/console cache:clear. (usually the name of your home folder)
Apparently your web server (apache?) already created some files or dirs in the cache folder (so they are owned be the web servers user, probably www-data). In this case a chmod isn't enough, you have to execute a chown -R anton app/cache app/log.
To avoid the general problem of different owners of different cache files, your console user and the user executing php for the web server should be the same. There are different ways to accomplish this. You could:
Change your apache configuration, so the apache runs with your user (anton) rather than www-data
Drop mod_php and use php5-fpm instead (and configure it to use your user)
Use fast_cgi

Proper permissions for my SVN repository directory tree on Mac?

I restored my Mac form a Time Machine backup, and now I can't check files into my svn repo.
I have tried svnadmin recover, but it fails:
svnadmin: Can't open file 'WriteAssist/db/write-lock': Permission denied
The directory is owned by the "admin" user that I set up for bootstrapping the machine. My current user is "andersprivat".
Should I just chown the entire tree? Doing a chmod 777 would presumably work, but seems like a big security hole.
In the end svnadmin recover appeared to do nothing at all for me.
I ended up having to chmod -R 777 all the files to be allowed to check in at all, then manually handling all in-flight issues. Did not leave me loving svn any more than I already did. When it works it's great, but getting it up when it has stumbled is a b*tch.

Mac Lion Apache can't view files in document root

Apache is running, localhost is working, if I put an index.html that works as well. However I can't access any folders (my websites) within the document root, which is /Users/Me/Sites
I get a forbidden error when I try to access these.
What's going wrong?
You should check the permissions of your home folder and your sites directory to make sure that they allow Apache access.
You could check the permissions, or just run (in a Terminal)
chmod o+x $HOME
chmod -R o+rX $HOME/Sites

Resources