Need help to config local storage

I just installed a fresh copy of NC, referring to my previous post on trouble getting the external storage app enabled. This is now fixed but I still cannot connect to local drive.

I have followed the instruction from here.

However, it is not clear to me (please pardon me as I am a newbie to linux and nextcloud, but I am a keen learner), whether I should do the following command using root or another user

sudo chown -R www-data:www-data /path/to/localdir
sudo chmod -R 0750 /path/to/localdir

Also not sure the following steps are requird

Important: If you use consecutive commands, make sure, you are user www-data:

sudo -u www-data bash cd /path/to/localdir mkdir data

The path for the local drive (not the same where nextcloud is installed, but on the same computer) is /media/fuzzygel/4T-ubuntu/nextcloud/data/

but I keep getting error when I set up the path

clearly, I have done something wrong, but not sure it is a permission issue or setting the path.

Appreciate some advice how to fix this . Let me know if more details are required

Is this directory set to the correct user www-data and correct group www-data?

You can test write access:
sudo -u www-data touch /media/fuzzygel/4T-ubuntu/nextcloud/data/testfile
Please delete the testfile afterwards.

I think that is the issue, I do not know which group I should set that up. As I mentioned before , I followed the instruction and excecuted the follow commands but not sure which user , is that for www-data? how do I log in as www-data, I cannot recall setting up a password for that

sudo chown -R www-data:www-data /path/to/localdir
sudo chmod -R 0750 /path/to/localdir

you are correct, I do not have permisson logged in as myself and root

And now? Do you get an error with my command to create testfile with user www-data?

Post:

ls -la /media/fuzzygel/4T-ubuntu/nextcloud/data

And if useful:
mount
cat /etc/fstab

no access

thanks again for the quick advice

ran the above commands as normal user (not root , not as www-data) and have the following results

fuzzygel@fuzzygel-Z390:~$ 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=32835792k,nr_inodes=8208948,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=6578520k,mode=755,inode64)
/dev/mapper/nvme0n1p1_crypt on / type ext4 (rw,relatime,errors=remount-ro)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
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)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=33783)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
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)
none on /run/credentials/systemd-sysusers.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
/var/lib/snapd/snaps/bare_5.snap on /snap/bare/5 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/1password_132.snap on /snap/1password/132 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/core18_2679.snap on /snap/core18/2679 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/core20_1587.snap on /snap/core20/1587 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/core20_1778.snap on /snap/core20/1778 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/firefox_2311.snap on /snap/firefox/2311 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-28-1804_161.snap on /snap/gnome-3-28-1804/161 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-38-2004_112.snap on /snap/gnome-3-38-2004/112 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-38-2004_119.snap on /snap/gnome-3-38-2004/119 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/gtk-common-themes_1535.snap on /snap/gtk-common-themes/1535 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/snap-store_582.snap on /snap/snap-store/582 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/snap-store_638.snap on /snap/snap-store/638 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/snapd_17950.snap on /snap/snapd/17950 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/snapd-desktop-integration_14.snap on /snap/snapd-desktop-integration/14 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/var/lib/snapd/snaps/snapd-desktop-integration_49.snap on /snap/snapd-desktop-integration/49 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/dev/mapper/nvme0n1p1_crypt on /var/snap/firefox/common/host-hunspell type ext4 (ro,noexec,noatime,errors=remount-ro)
/var/lib/snapd/snaps/upnote_52.snap on /snap/upnote/52 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
/dev/nvme0n1p3 on /boot type ext4 (rw,relatime)
/dev/nvme0n1p2 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/snapd/ns type tmpfs (rw,nosuid,nodev,noexec,relatime,size=6578520k,mode=755,inode64)
nsfs on /run/snapd/ns/snapd-desktop-integration.mnt type nsfs (rw)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=6578516k,nr_inodes=1644629,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
nsfs on /run/snapd/ns/snap-store.mnt type nsfs (rw)
nsfs on /run/snapd/ns/firefox.mnt type nsfs (rw)
/var/lib/snapd/snaps/upnote_55.snap on /snap/upnote/55 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
nsfs on /run/snapd/ns/upnote.mnt type nsfs (rw)
nsfs on /run/snapd/ns/1password.mnt type nsfs (rw)
/dev/mapper/luks-9e2bb7cf-2f0a-413b-8272-276630ecc971 on /media/fuzzygel/4T-ubuntu type ext4 (rw,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2)
/dev/mapper/luks-9e2bb7cf-2f0a-413b-8272-276630ecc971 on /run/timeshift/backup type ext4 (rw,relatime,errors=remount-ro)
fuzzygel@fuzzygel-Z390:~$ cat /etc/fstab

/etc/fstab: static file system information.

Use ‘blkid’ to print the universally unique identifier for a

device; this may be used with UUID= as a more robust way to name devices

that works even if disks are added and removed. See fstab(5).

/dev/mapper/nvme0n1p1_crypt / ext4 errors=remount-ro 0 1

/boot was on /dev/nvme0n1p3 during installation

UUID=f0eda54c-0b3d-4130-83ca-44305e0b445f /boot ext4 defaults 0 2

/boot/efi was on /dev/nvme0n1p2 during installation

UUID=3EC5-9E5D /boot/efi vfat umask=0077 0 1
fuzzygel@fuzzygel-Z390:~$

I do not know what that mean

Versuch mal als root bzw. sudo:
sudo ls -la /media/fuzzygel/4T-ubuntu/nextcloud/data
(brauchst nur den obersten Ordner dann hier posten)

Das ist die interessante Zeile. Ich sehe hier erst mal nichts besonderes.

execute as root

root@fuzzygel-Z390:~# sudo ls -la /media/fuzzygel/4T-ubuntu/nextcloud/data
total 8
drwxrwxr-x 2 www-data www-data 4096 Feb 6 15:16 .
drwxr-x— 3 www-data www-data 4096 Feb 6 15:16 …
root@fuzzygel-Z390:~#

I tried to log in as www-data but none of the known passwords work, is it possible to reset ?

and what is the next step?

Finally, really appreciate your patience with me, and your help along the way

www-data can not login (see /etc/passwd). You must not login. But you can execute www-data-commands like posted above:
sudo -u www-data touch /media/fuzzygel/4T-ubuntu/nextcloud/data/testfile
root executes the command that www-data creates (touch) the file testfile. Post the error.

error as follows

root@fuzzygel-Z390:~# sudo -u www-data touch /media/fuzzygel/4T-ubuntu/nextcloud/data/testfile
touch: cannot touch ‘/media/fuzzygel/4T-ubuntu/nextcloud/data/testfile’: Permission denied
root@fuzzygel-Z390:~#

Dann ist es wohl falsch gemountet siehe fstab-Eintrag. Damit kenn ich mich aber leider nicht wirklich aus bzw. ich sehe auf den ersten Blick nicht den Fehler in dem Eintrag.

Then it is probably mounted incorrectly see fstab entry. But I don’t really know about that or I don’t see the error in the entry at first sight.

not to worry, let me do some more research. Thanks a lot regardless

I am getting no where with this issue

reaching out to all experts here to help

Had not the same but close error.

uid=www-data,gid=www-data,file_mode=0777

In fstab fixed it for me.

thanks, as a newbie, I have follow up questions

what fstab command did you use to fix it

can I use chmod to fix the permission issue?

I just remember the local drive is encrypted , not sure it changes things

the mount points are either

/dev/mapper/luks-9e2bb7cf-2f0a-413b-8272-276630ecc971:

or simply

/dev/sda

on Gnome file menu, it is showing as

just an update , I deleted the partition (which was encrypted ) and set up a new partition of the same size but without the encryption

but some error occurred, I followed the instruction here

so it is nothing to do with encryption

and I did a ls -la with the following result, does it mean that the permission is given to www-data?

if all permission is correct, why can I set up the local storage?

root@fuzzygel-Z390:/media/fuzzygel/4T/nextcloud4T# sudo ls -la
total 8
drwxrwxrwx 2 fuzzygel www-data 4096 Feb 9 06:53 .
drwx------ 5 fuzzygel fuzzygel 4096 Feb 9 07:02 …

@fuzzygel, have you try this again ??

if it didn’t work, check permission for all parent directories (especially check if they all have the letter r in the 3 last character. exemple : drwxr-xr-x )

1 Like

thank you so much, your proposed solution has resolved the issue that I have been trying to solve for a week.

FYI, I had to redo all the permission all the way to the parent. Really appreciate the help

2 Likes