[SOLVED] Dirs change owner when rebooting

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Rander
Level 1
Level 1
Posts: 43
Joined: Mon Nov 12, 2018 2:02 pm

[SOLVED] Dirs change owner when rebooting

Post by Rander »

This one is driving me mad...

I created a few sub-dirs under /mnt to be used as mountpoints for some user-mountable nfs shares. So, I changes the owner of them to lars.lars (my user and group), and it works fine.

The problem is that every time I reboot, the ownership changes to root.root, and so the shares are no longer user-mountable. Oddly, mountpoints that connect to local drives does not change user.

I wondering if it can be something I did wrong in my fstab? What do I have to do to make the dirs retain ownership across reboots?

My fstab:

Code: Select all

# /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).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
UUID=45c8dec4-1bc9-4646-a89a-49d023edbcad /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=BDB8-0FF0  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

LABEL="Home"        /home           ext4    defaults    0   2
LABEL="Data"        /mnt/Data       ext4    defaults    0   2
LABEL="TimeShift"   /mnt/TimeShift  ext4    defaults    0   2

192.168.11.21:/volume1/Backup   /mnt/ds-Backup  nfs noauto,x-systemd.automount,x-systemd.mount-timeout=30,user    0   0
192.168.11.21:/volume1/music    /mnt/ds-music   nfs noauto,x-systemd.automount,x-systemd.mount-timeout=30,user    0   0
192.168.11.21:/volume1/video    /mnt/ds-video   nfs noauto,x-systemd.automount,x-systemd.mount-timeout=30,user    0   0
192.168.11.22:/volume1/Film     /mnt/ds-Film    nfs noauto,x-systemd.automount,x-systemd.mount-timeout=30,user    0   0

Only the nfs-shares have this problem - Data and TimeShift works flawlessly.

If necessary:

Code: Select all

System:    Kernel: 5.4.0-70-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 4.8.6 wm: muffin 4.8.1 
           dm: LightDM 1.30.0 Distro: Linux Mint 20.1 Ulyssa base: Ubuntu 20.04 focal 
Machine:   Type: Desktop System: Dell product: OptiPlex 7010 v: 01 serial: <filter> Chassis: type: 6 serial: <filter> 
           Mobo: Dell model: 0GY6Y8 v: A02 serial: <filter> UEFI: Dell v: A16 date: 09/09/2013 
CPU:       Topology: Quad Core model: Intel Core i7-3770 bits: 64 type: MT MCP arch: Ivy Bridge rev: 9 L2 cache: 8192 KiB 
           flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 54277 
           Speed: 1623 MHz min/max: 1600/3900 MHz Core speeds (MHz): 1: 1628 2: 1597 3: 1597 4: 1597 5: 1596 6: 1597 
           7: 1597 8: 1596 
Graphics:  Device-1: AMD Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X] vendor: Sapphire Limited driver: amdgpu 
           v: kernel bus ID: 01:00.0 chip ID: 1002:699f 
           Display: x11 server: X.Org 1.20.9 driver: amdgpu,ati unloaded: fbdev,modesetting,vesa 
           resolution: 1920x1080~60Hz 
           OpenGL: renderer: Radeon RX550/550 Series (POLARIS12 DRM 3.35.0 5.4.0-70-generic LLVM 11.0.0) 
           v: 4.6 Mesa 20.2.6 direct render: Yes 
Audio:     Device-1: AMD Baffin HDMI/DP Audio [Radeon RX 550 640SP / RX 560/560X] vendor: Sapphire Limited 
           driver: snd_hda_intel v: kernel bus ID: 01:00.1 chip ID: 1002:aae0 
           Device-2: Creative type: USB driver: snd-usb-audio bus ID: 1-1.1:3 chip ID: 041e:30df serial: <filter> 
           Sound Server: ALSA v: k5.4.0-70-generic 
Network:   Device-1: Intel 82579LM Gigabit Network vendor: Dell driver: e1000e v: 3.2.6-k port: f040 bus ID: 00:19.0 
           chip ID: 8086:1502 
           IF: eno1 state: up speed: 1000 Mbps duplex: full mac: <filter> 
Drives:    Local Storage: total: 7.50 TiB used: 752.15 GiB (9.8%) 
           ID-1: /dev/sda vendor: SanDisk model: SSD PLUS 240GB size: 223.58 GiB speed: 6.0 Gb/s serial: <filter> 
           rev: 00RL scheme: GPT 
           ID-2: /dev/sdb vendor: Seagate model: ST6000DM003-2CY186 size: 5.46 TiB speed: 6.0 Gb/s rotation: 5425 rpm 
           serial: <filter> rev: 0001 scheme: GPT 
           ID-3: /dev/sdc vendor: Seagate model: ST32000641AS size: 1.82 TiB speed: 3.0 Gb/s rotation: 7200 rpm 
           serial: <filter> rev: CC13 scheme: MBR 
Partition: ID-1: / size: 218.57 GiB used: 23.18 GiB (10.6%) fs: ext4 dev: /dev/sda2 
           ID-2: /home size: 5.41 TiB used: 426.27 GiB (7.7%) fs: ext4 dev: /dev/sdb1 
Sensors:   System Temperatures: cpu: 29.8 C mobo: 27.8 C gpu: amdgpu temp: 43 C 
           Fan Speeds (RPM): N/A gpu: amdgpu fan: 1131 
Repos:     No active apt repos in: /etc/apt/sources.list 
           Active apt repos in: /etc/apt/sources.list.d/additional-repositories.list 
           1: deb https://repo.vivaldi.com/archive/deb/ stable main
           Active apt repos in: /etc/apt/sources.list.d/gezakovacs-ppa-focal.list 
           1: deb http://ppa.launchpad.net/gezakovacs/ppa/ubuntu focal main
           Active apt repos in: /etc/apt/sources.list.d/google-chrome.list 
           1: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
           Active apt repos in: /etc/apt/sources.list.d/hizo-mkv-extractor-gui-focal.list 
           1: deb http://ppa.launchpad.net/hizo/mkv-extractor-gui/ubuntu focal main
           No active apt repos in: /etc/apt/sources.list.d/mkvtoolnix.download.list 
           Active apt repos in: /etc/apt/sources.list.d/obsproject-obs-studio-focal.list 
           1: deb http://ppa.launchpad.net/obsproject/obs-studio/ubuntu focal main
           Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list 
           1: deb http://mirrors.dotsrc.org/linuxmint-packages ulyssa main upstream import backport
           2: deb http://mirror.one.com/ubuntu focal main restricted universe multiverse
           3: deb http://mirror.one.com/ubuntu focal-updates main restricted universe multiverse
           4: deb http://mirror.one.com/ubuntu focal-backports main restricted universe multiverse
           5: deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
           6: deb http://archive.canonical.com/ubuntu/ focal partner
           Active apt repos in: /etc/apt/sources.list.d/teams.list 
           1: deb [arch=amd64] https://packages.microsoft.com/repos/ms-teams stable main
           Active apt repos in: /etc/apt/sources.list.d/ubuntuhandbook1-apps-focal.list 
           1: deb http://ppa.launchpad.net/ubuntuhandbook1/apps/ubuntu focal main
Info:      Processes: 311 Uptime: 5h 10m Memory: 31.32 GiB used: 5.53 GiB (17.7%) Init: systemd v: 245 runlevel: 5 
           Compilers: gcc: 9.3.0 alt: 7/9 Shell: bash v: 5.0.17 running in: gnome-terminal inxi: 3.0.38 
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Dirs change owner when rebooting

Post by AndyMH »

ds - is this a diskstation? Not an expert with nfs, managed to get it working and then reverted to cifs. Have you changed the squash settings on the synology?
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Rander
Level 1
Level 1
Posts: 43
Joined: Mon Nov 12, 2018 2:02 pm

Re: Dirs change owner when rebooting

Post by Rander »

Yes, it is a DiskStation - and yes, I changed the squash-settings.

Is I said, it works fine as it should, until I restart my computer, then it changes the ownership of the mount points, regardless if anything is mounted there or not!
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Dirs change owner when rebooting

Post by AndyMH »

As said I'm not an expert with nfs, use cifs to connect to my diskstation. Is there any chance that the IP address of your client PC changes after a reboot (or are you using hostname.local instead of the IP address - if you are how did you make it work, I couldn't)?

Not that I'm suggesting it as a long term solution, but does allowing anyone access (third entry = *) fix the problem?
Screenshot from 2021-04-02 13-50-15.png
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Rander
Level 1
Level 1
Posts: 43
Joined: Mon Nov 12, 2018 2:02 pm

Re: Dirs change owner when rebooting

Post by Rander »

No, I'm running with fixed IP's. And I don't think the DiskStation has anything to do about it, as this happens before I even try to mount the shares. I even tried powering of the ds while rebooting the computer - it still does it... :-(
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Dirs change owner when rebooting

Post by rene »

It's hard to get a consistent picture from this thread due to the strange combination of automounting and the user parameter in fstab so let's just back up.

With the NFS shares unmounted make sure from ls -l /mnt that their mountpoints /mnt/ds-Backup etc. are root:root-owned; delete the user option in their fstab lines and reboot. Access as your user the shares under /mnt/ds-Backup etc. which should get them automounted; don't explicitly mount. Only with them mounted do e.g. sudo chown -R lars: /mnt/ds-Backup.

If permissions "don't stick" in that basic case the only option is your NAS not honouring, perhaps/probably as a matter of an option in its NFS share-specific settings somewhere, lars:lars (better, 1000:1000) as a valid ownership; it mapping all to 0:0.
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Dirs change owner when rebooting

Post by AndyMH »

rene wrote: Fri Apr 02, 2021 9:21 pm If permissions "don't stick" in that basic case the only option is your NAS not honouring, perhaps/probably as a matter of an option in its NFS share-specific settings somewhere, lars:lars (better, 1000:1000) as a valid ownership; it mapping all to 0:0.
There are only a limited number of squash options on the synology
  • No mapping
  • Map root to admin
  • Map root to guest
  • Map all users to admin
  • Map all users to guest
The default no mapping means the mount is read only, in the limited playing around I did 'map all users to admin' gave me read/write access. I found cifs easier :)
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Dirs change owner when rebooting

Post by rene »

AndyMH wrote: Sat Apr 03, 2021 5:18 am The default no mapping means the mount is read only
Eek? At https://www.synology.com/en-global/know ... etwork_NFS the "No mapping" option is described as doing what I would expect it to and as what I find to be the only "correct" choice for integration into a UNIX environment, i.e., the NAS simply not interfering with ownerships; storing them as is.
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Dirs change owner when rebooting

Post by AndyMH »

rene wrote: Sat Apr 03, 2021 6:06 am Eek? At https://www.synology.com/en-global/know ... etwork_NFS the "No mapping" option is described as doing what I would expect it to and as what I find to be the only "correct" choice for integration into a UNIX environment, i.e., the NAS simply not interfering with ownerships; storing them as is.
As I said, I've only had a cursory look at nfs, enough to get it to work, so could be wrong. I'm happy with my cifs mounts.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Rander
Level 1
Level 1
Posts: 43
Joined: Mon Nov 12, 2018 2:02 pm

Re: Dirs change owner when rebooting

Post by Rander »

rene wrote: Fri Apr 02, 2021 9:21 pm It's hard to get a consistent picture from this thread due to the strange combination of automounting and the user parameter in fstab so let's just back up.
[...]
Wow, that did it! I just figured that I needed the user parameter, or I needed to be root to mount it!

It is now working as intended. Thank you! :-)
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: [SOLVED] Dirs change owner when rebooting

Post by rene »

Sure. With your use of systemd automounting the piece of software that in fact mounts the NFS-share when it is accessed (systemd) does run as root so that's why it works: the "user" parameter is only for when you want to allow nonroot users to manually mount the share. And once mounted, and save for e.g. the above mentioned "mapping" parameters that the server (the NAS, here) may employ, permissions on an NFS-share work exactly the same as on a local UNIX filesystem, including you giving or denying yourself rights with chown/chmod.

The perhaps biggest user-facing difference between NFS and CIFS is the very same as said biggest difference between UNIX filesystems such as ext4 on the one hand and FAT/NTFS on the other: latter not providing for (basic, integral) per-file/directory multi-user functionality, what with them having come from a by norm single-user environment. Now of course, single-user is in practice also the Linux Mint norm, but still quite fundamentally not the larger UNIX norm. As such, shoehorning CIFS into a UNIX environment tends to only work to confuse things whereas given familiarity with UNIX concepts NFS is conceptually dead simple.

Which by the way is not to say that NFS is in every sense great nor that CIFS may not do some things right --- but I personally still advise latter only to those who know when to in fact use it and/or when there's no other (good) possibility such as when talking to CIFS-only appliances and/or Windows machines.
Locked

Return to “Other topics”