Jump to content

Nextcloud in a VM: Using share as Nextcloud data directory

Recommended Posts


I installed a 4TB disk in my server with the purpose to use it as a NextCloud data directory. I've set up all my usual shares to exclude the new disk. And made a new share which uses only the new disk.

I installed Fedora server 33 on a VM. And installed the packages nextcloud and nextcloud-nginx and I can get to the installation page, however, I can't get write permissions for Nextcloud on the mounted Unraid share.

The share is mounted on /data through /etc/fstab:

data /data 9p trans=virtio,version=9p2000.L,_netdev,rw 0 0

..and I can write to it through the terminal.

Output of mount is:

$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,noexec,seclabel,size=991228k,nr_inodes=247807,mode=755,inode64)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,size=404164k,nr_inodes=819200,mode=755,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime,seclabel)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
none on /sys/kernel/tracing type tracefs (rw,relatime,seclabel)
/dev/mapper/fedora_fedora-root on / type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,nosuid,noexec,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13185)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime,seclabel)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,seclabel,size=1010412k,nr_inodes=409600,inode64)
/dev/vda2 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
/dev/vda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=202080k,nr_inodes=50520,mode=700,uid=1000,gid=1000,inode64)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,nosuid,nodev,noexec,relatime,seclabel)
data on /data type 9p (rw,relatime,sync,dirsync,access=client,trans=virtio,_netdev)

NextCloud is installed in /usr/share/nextcloud:

$ ls -lh /usr/share/nextcloud/
total 60K
drwxr-xr-x. 40 root root 4.0K Mar 30 15:45 3rdparty
drwxr-xr-x. 44 root root 4.0K Mar 30 15:45 apps
lrwxrwxrwx.  1 root root   14 Feb 20 16:47 config -> /etc/nextcloud
-rw-r--r--.  1 root root 3.9K Jan 25 16:31 console.php
drwxr-xr-x. 23 root root 4.0K Mar 30 15:45 core
-rw-r--r--.  1 root root 5.1K Jan 25 16:31 cron.php
-rw-r--r--.  1 root root  156 Jan 25 16:31 index.html
-rw-r--r--.  1 root root 2.9K Jan 25 16:31 index.php
drwxr-xr-x.  6 root root  125 Mar 30 15:45 lib
-rwxr-xr-x.  1 root root  279 Feb 20 16:46 occ
drwxr-xr-x.  2 root root   23 Mar 30 15:45 ocm-provider
drwxr-xr-x.  2 root root   55 Mar 30 15:45 ocs
drwxr-xr-x.  2 root root   23 Mar 30 15:45 ocs-provider
-rw-r--r--.  1 root root 3.1K Jan 25 16:31 public.php
-rw-r--r--.  1 root root 5.3K Jan 25 16:31 remote.php
drwxr-xr-x.  4 root root  133 Mar 30 15:45 resources
-rw-r--r--.  1 root root   26 Jan 25 16:31 robots.txt
-rw-r--r--.  1 root root 2.4K Jan 25 16:31 status.php
drwxr-xr-x.  3 root root   35 Mar 30 15:45 themes
drwxr-xr-x.  2 root root   43 Mar 30 15:45 updater
-rw-r--r--.  1 root root  362 Jan 25 16:34 version.php

the config directory gets symlinked to /etc/nextcloud

$ ls -lh /etc/nextcloud/
total 4.0K
lrwxrwxrwx. 1 root   root    32 Feb 20 16:47 ca-bundle.crt -> /etc/pki/tls/certs/ca-bundle.crt
-rw-------. 1 apache apache 670 Feb 20 16:44 config.php

As you can see the webroot files are owned by root, and the config.php is owned by apache. In nginx.conf I have user nginx which suggests nginx is run by the nginx user.

These are the users on the system:

$ cat /etc/passwd
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:65534:65534:Kernel Overflow User:/:/sbin/nologin
systemd-coredump:x:999:997:systemd Core Dumper:/:/sbin/nologin
systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
systemd-resolve:x:193:193:systemd Resolver:/:/sbin/nologin
systemd-timesync:x:998:996:systemd Time Synchronization:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:997:995:User for polkitd:/:/sbin/nologin
tss:x:59:59:Account used for TPM access:/dev/null:/sbin/nologin
rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
cockpit-ws:x:995:990:User for cockpit web service:/nonexisting:/sbin/nologin
cockpit-wsinstance:x:994:989:User for cockpit-ws instances:/nonexisting:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
dnsmasq:x:988:988:Dnsmasq DHCP and DNS server:/var/lib/dnsmasq:/usr/sbin/nologin
clevis:x:986:986:Clevis Decryption Framework unprivileged user:/var/cache/clevis:/sbin/nologin
unbound:x:985:985:Unbound DNS resolver:/etc/unbound:/sbin/nologin
nginx:x:984:984:Nginx web server:/var/lib/nginx:/sbin/nologin
mysql:x:27:27:MySQL Server:/var/lib/mysql:/sbin/nologin


I have tried every combination of chown -R <username>:<username> /data (where <username> is any of root, apache or nginx mentioned above). I've even tried making a subdirectory in /data and trying to change the ownership of that directory according to the previous mentioned methods without success.

If anyone would be able to tell me what I'm doing wrong I would be extremely grateful. Tried setting up this for 3 hours now with no success.

Thanks in advance!

Edited by maetthew
Link to comment
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...