0

I'm new over on this forum so apologies if this is in the wrong section...I'm used to StackOverflow.

Anyway, I've got a problem: I want to point ownCloud to a directory on my server that contains website files but I can't seem to make it work. This way, I can log in to ownCloud and edit my website files. I realize this isn't the most secure thing to do but I'm planning to put more security into it once I figure out how.

I've read countless tutorials on how to install ownCloud so that's not my problem.

Thanks in advance

1

You can mount a directory on your server with the External storage support application (built in) via SFTP. In ownCloud:

  • login to your admin account
  • go to Apps
  • activate External storage support
  • go to Admin UI
  • scroll down and enable the SFTP option

Now for a little bit more complicated user setup since you might want to edit the files both with your local editor and with your ownCloud text editor application. Also, this increases the security a little bit (emphasis: "a little").

I assume you have set up your Apache/nginx properly and have defined your virtual hosts as well. For now the directory is in /var/www/website.

create a system user for accessing the website's directory

sudo adduser <username> #we'll call that user 'editor' for now

set proper directory permissions

sudo chown -R www-data:editor /var/www/website

grant writing permissions to group editor for that directory and subdirectories

sudo find /var/www/website -type f -exec chmod 664 {} +; #for files
sudo find /var/www/website -type d -exec chmod 775 {} +; #for directories

If you want to know the current directory permissions:

stat -c %a /var/www/website

Sidenote: Take care about the writing permissions! 775 and 664 are not to be considered safe, you'll definitely need to know what you are doing here. The best option is not to set the permissions throughout the whole directory but set them for each subdirectory in particular. If you do so, you should consider changing your SSH configuration to only allow SSH access via public key without password access. Also look at denyhosts, fail2ban, IPtables and all the great tools out there helping in hardening a server.

Get back to your ownCloud Admin UI and configure an external storage via SFTP:

  • Directory name: your choice
  • Type: SFTP obviously
  • Host: localhost
  • User: editor
  • Password: Swordfish (of course)
  • Root: /var/www/website
  • On the right: Only make that external storage available to your specific user.

Keep in mind that SFTP access is pretty slow, but at least it gets stuff done.

|improve this answer|||||
  • Thanks for your solution. I'm not sure if I was able to achieve what I want...for some reason if I click the external storage section, then the folder I made, it just goes to the default "all files" category...I don't see my website files. Also, there's a little red square next to the folder setup in the admin page. Did I miss something? – Andrew Quebe Mar 20 '15 at 23:58
  • I might know the problem: does having SSH keys have anything to do with SFTP? I have SFTP set up for Filezilla because of my SSH key set up. – Andrew Quebe Mar 21 '15 at 0:01
  • 1
    If you see a red square it means that your configuration is not correct. 1. check the file / directory permissions (www-data:editor) 2. check the read-write-execute stuff 3. Have you logged in and out with the user you created like above? 4. Test your connection / access rights by: 4.1. start Nautilus on local machine 4.2. Ctrl+L 4.3. enter ssh://server/var/www/website 4.4. if you can see, read, write, then your permissions should be correct – leonis_csem Mar 21 '15 at 20:57
  • 1
    About SFTP and SSH keys: SSH keys should not interfere with ownCloud's logic. We access all our servers via SSH keypairs and still can access the files. – leonis_csem Mar 21 '15 at 21:01
  • 1
    Happy to help. Whenever you need smthg like adding Dropbox, Google Drive, SMB, <insert whatever here>, simply post here, I'll write a short how-to. – leonis_csem Mar 22 '15 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.