Fresh Install can't create or write data directory

Hello,

I try to install Nextcloud 15.0.7 DATA directory on a second hard disk.
during the installation should i change the directory in: nextcloud.conf ?

This is how look like the original nextcloud.conf

Alias /nextcloud "/var/www/nextcloud/"

<Directory /var/www/nextcloud/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off
 </IfModule>

 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud

</Directory>

Do I need to edit the data directory in this file?
I tried but when I arrive to nextcloud web interface and tried to change also the original directory to my second hard drive (formated in EXFAT) it said that nextcloud can’t find or write.

Maybe nextcloud DATA directory can’t be on an EXFAT drive?
Shall I format it into 4ext?

and wich line exactly need to be edited to change the DATA directory.

before to write this post I tried several time and I read a lot of post, however it remain confusing to me but I guess change the directory before to finish the installation shall not be that difficult.

thank to the people that will take time to read and help if they can.

1 Like

this is the path to the nextcloud program files (index.php and so forth).
don’t edit. no need to.

when you first access the web gui you are asked for some setting. one of them is the path to your data folder. this will go to /var/www/nextcloud/config/config.php

if you get an error check if the linux user of your web server (e.g. www-data) can access your data folder. if not use chown to change the ownership of the data folder.

and it’s always wise to use linux fs (ext4) on linux systems. but it shouldn’t matter in your case.

Thank you for answering,

I tried to change the directory and it get back:
Can’t create or write into the data directory

if you get an error check if the linux user of your web server (e.g. www-data) can access your data folder. if not use chown to change the ownership of the data folder.

How can I do this? I am a bit new to linux environement.

what’s your os? (debian/ubuntu/centos)
what’s the path to your data folder?

Linux Mint 19.1

the path I try to apply is: /media/hardisk/NEXTCLOUD

ls -l /var/www
ls -l /media/hardisk

the owner of the nextcloud folder in /var/www should be also the owner of the /media/hardisk/NEXTCLOUD folder. (my guess is www-data:www-data)

to change the ownership

chown -R www-data:www-data /media/hardisk/NEXTCLOUD

(if www-data is the correct user)

1 Like

I copied:

ls -l /var/www
ls -l /media/hardisk

I got :

total 8
drwxr-xr-x 2 root root 4096 Apr 17 16:25 html
drwxr-xr-x 15 www-data www-data 4096 Apr 17 16:32 nextcloud

I copied:

ls -l /media/hardisk

I got :

drwxrwxrwx 1 hardisk hardisk 32768 Jan 1 1970 EC69-CC5C
drwxrwxrwx 1 hardisk hardisk 131072 Apr 17 16:34 NEXTCLOUD

This line:
chown -R www-data:www-data /media/hardisk/NEXTCLOUD

I get permision denied on all the line.

After applied :

ls -l /var/www
ls -l /media/hardisk

I opened sudo nano /etc/apache2/conf-available/nextcloud.conf
and now the file is empty is it normal?

sorry. i forgot.

sudo chown -R www-data:www-data /media/hardisk/NEXTCLOUD

no. but it has nothing to do with the commands you entered now.

I also tried with Sudo but

sudo chown -R www-data:www-data /media/hardisk/NEXTCLOUD operation not permited

I also tried to use “SU” instead sudo but it keep saying I am not permitted.

Alright I will try to resume clearly the situation.
The line command you gave me been helpful.

If I open the web Gui of nextcloud I can see that the directory path is there I want.
However when I try to log as admin for the first time it keep saying:

Can’t create or write into the data directory /media/hardisk/nextcloud

If I right click on the hardisk there I want to place the DATA I can see:

Owner: www-data
folder access: create and delete files

Group: www-data
Folder access: Create and delete files

Folder access: Create and delete files

The user from the original /var/www is www-data,
as my second hard disk, then I have no Idea why I can’t write in it…

Any idea ?

Edit: I even after used shown to give access and set the same owner for everything nextcloud keep saying that it can’t write…

what’s the output of mount ?

Hello, well if I type mount i get this:

~$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=8136412k,nr_inodes=2034103,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=1633560k,mode=755)
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=45,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=533)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1633556k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sdf1 on /media/maru/EC69-CC5C type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)
/dev/sdc1 on /media/maru/nextcloud type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
/dev/sdd1 on /media/maru/Toshiba 260go type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)
/dev/sdg2 on /media/maru/WD RED NAS type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)

linux folder names are case sensitive. these are two different folders.

in the output of mount I could only find this nextcloud folder.

Thank you again to take time to help.

I tried many change and many thing, it was not working so it came back to this configuration.

Linux Mint name user:

Maru

The owner remain:

www-data

The name of the hardisk there I try to create the “data directory” is “nextcloud”

/media/maru/nextcloud

I used the command you gave me so the hardisk owner is also:

www-data

However I just saw that:
If from the desktop I do right click on my Hardisk named “Nextcloud” Linux said he can’t determinate the permission, but If I open Linux explorer and right click on the Hardisk it says that www-data is the owner.

Could my Linux be broken?
From desktop:

From Explorer:

I decided to re start from Zero, clean install.
and the problem is the same.

If you want take a look by teamviewer I don’t mind I have no more idea…

Mount result:

root@maru:~# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=8136432k,nr_inodes=2034108,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=1633560k,mode=755)
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=25,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=527)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1633556k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=1633556k,mode=700)
gvfsd-fuse on /run/user/0/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
/dev/sdc1 on /media/maru/nextcloud type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
gvfsd-fuse on /root/.gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
/dev/fuse on /root/.cache/doc type fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
root@maru:~#

Hardisk Permissions:

/var/www Permissions

To me all seems to be as it should be…
I start to think that it will be easier to do it with a VM using the hardisk I want for data😔…

i don’t know linux mint. so i can’t really help.

my last guess: did you check the status of apparmor? sudo aa_status.
(security - Is AppArmor actively used by Linux Mint 18? - Unix & Linux Stack Exchange)

if you use a server oriented linux it might be easier. :wink:

Again thank you for your time,
I never heard before about apparmor.
It’s sound like a guard to protect your system?

sudo apparmor_status

apparmor module is loaded.
60 profiles are loaded.
21 profiles are in enforce mode.
/sbin/dhclient
/usr/bin/man
/usr/lib/NetworkManager/nm-dhcp-client.action
/usr/lib/NetworkManager/nm-dhcp-helper
/usr/lib/chromium-browser/chromium-browser//browser_java
/usr/lib/chromium-browser/chromium-browser//browser_openjdk
/usr/lib/chromium-browser/chromium-browser//sanitized_helper
/usr/lib/connman/scripts/dhclient-script
/usr/lib/cups/backend/cups-pdf
/usr/lib/lightdm/lightdm-guest-session
/usr/lib/lightdm/lightdm-guest-session//chromium
/usr/sbin/cups-browsed
/usr/sbin/cupsd
/usr/sbin/cupsd//third_party
/usr/sbin/ippusbxd
/usr/sbin/tcpdump
libreoffice-senddoc
libreoffice-soffice//gpg
libreoffice-xpdfimport
man_filter
man_groff
39 profiles are in complain mode.
/usr/lib/chromium-browser/chromium-browser
/usr/lib/chromium-browser/chromium-browser//chromium_browser_sandbox
/usr/lib/chromium-browser/chromium-browser//lsb_release
/usr/lib/chromium-browser/chromium-browser//xdgsettings
/usr/lib/dovecot/anvil
/usr/lib/dovecot/auth
/usr/lib/dovecot/config
/usr/lib/dovecot/deliver
/usr/lib/dovecot/dict
/usr/lib/dovecot/dovecot-auth
/usr/lib/dovecot/dovecot-lda
/usr/lib/dovecot/dovecot-lda///usr/sbin/sendmail
/usr/lib/dovecot/imap
/usr/lib/dovecot/imap-login
/usr/lib/dovecot/lmtp
/usr/lib/dovecot/log
/usr/lib/dovecot/managesieve
/usr/lib/dovecot/managesieve-login
/usr/lib/dovecot/pop3
/usr/lib/dovecot/pop3-login
/usr/lib/dovecot/ssl-params
/usr/sbin/avahi-daemon
/usr/sbin/dnsmasq
/usr/sbin/dnsmasq//libvirt_leaseshelper
/usr/sbin/dovecot
/usr/sbin/identd
/usr/sbin/mdnsd
/usr/sbin/nmbd
/usr/sbin/nscd
/usr/sbin/smbd
/usr/sbin/smbldap-useradd
/usr/sbin/smbldap-useradd///etc/init.d/nscd
/usr/{sbin/traceroute,bin/traceroute.db}
klogd
libreoffice-oopslash
libreoffice-soffice
ping
syslog-ng
syslogd
12 processes have profiles defined.
2 processes are in enforce mode.
/usr/sbin/cups-browsed (2767)
/usr/sbin/cupsd (2766)
0 processes are in complain mode.
10 processes are unconfined but have a profile defined.
/usr/lib/chromium-browser/chromium-browser (3766)
/usr/lib/chromium-browser/chromium-browser (3783)
/usr/lib/chromium-browser/chromium-browser (3785)
/usr/lib/chromium-browser/chromium-browser (3989)
/usr/lib/chromium-browser/chromium-browser (4010)
/usr/lib/chromium-browser/chromium-browser (4224)
/usr/lib/chromium-browser/chromium-browser (4266)
/usr/lib/chromium-browser/chromium-browser (7414)
/usr/sbin/avahi-daemon (939)
/usr/sbin/avahi-daemon (956

Do I have to disable it?

it is supposed to prevent process to write where they shouldn’t. like malware is doing.

try it to find out if apparmor is the problem. if so find out how to configure apparmor to allow apache write to /media/maru/nextcloud

1 Like

Thank you, your help allow me to know more about linux.
Even after totaly disable Apparmor the problem is the same so I think it could be something else.

I will take time to try with another distribution of linux.