[Bug 1836461] Re: DirectoryMode is not considered in systemd automount
Dan Streetman
dan.streetman at canonical.com
Sun Sep 29 21:06:51 UTC 2019
> DirectoryMode=0777
so, you might misunderstand what this parameter does; with the mount and
automount units, it sets the mode *only* for directories that need to be
created *up to* the actual mountpoint. So if you had:
[Mount]
What=/dev/disk/by-label/some-label
Where=/media/one/two/disk-with-some-label
DirectoryMode=0777
then the dirs /media/one and /media/one/two will be (note: [1]) mode
0777. However, /media/one/two/disk-with-some-label will not be affected
by DirectoryMode, for both automount and mount units.
For mount units, the directory that is the actual mountpoint has its
mode replaced by the actual mode of the root directory of the mount.
For example:
root at lp1836461:/tmp# ls -ld a
drwxr-xr-x 2 root root 4096 Sep 29 20:59 a
root at lp1836461:/tmp# mount /dev/sda1 a
root at lp1836461:/tmp# ls -ld a
drwx------ 3 root root 1024 Sep 29 20:02 a
root at lp1836461:/tmp# umount a
root at lp1836461:/tmp# ls -ld a
drwxr-xr-x 2 root root 4096 Sep 29 20:59 a
in that example /tmp/a has mode 0755, while the root directory in the
filesystem at /dev/sda1 has mode 0700. The DirectoryMode specified to
the mount unit will not change the filesystem's root dir mode.
For automount units, the DirectoryMode similarly only sets the mode for
newly created dirs leading up to the actual mountpoint. Additionally,
while the mountpoint is waiting for automount, its mode is set to 0755,
but that doesn't matter because any actual access to the directory (e.g.
ls) will cause it to automount the filesystem, which will replace the
'fake' 0755 mode with the actual mode of the filesystem's root dir.
[1] - looks like there is a bug upstream that sets intermediate
automount dirs to 0555, which I'll open a bug for, but for the
description of your use, that doesn't appear important.
** Changed in: systemd (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1836461
Title:
DirectoryMode is not considered in systemd automount
Status in systemd package in Ubuntu:
Invalid
Bug description:
With the following systemd mount unit file
[Unit]
Description=Additional drive
[Mount]
What=/dev/disk/by-label/some-label
Where=/media/disk-with-some-label
DirectoryMode=0777
[Install]
WantedBy=multi-user.target
and the following automount unit file
[Unit]
Description=Automount Additional Drive
[Automount]
Where=/media/disk-with-some-label
DirectoryMode=0777
[Install]
WantedBy=multi-user.target
If I do
systemctl start <unit-file-name-of-automount-unitfile>
and check the permissions on /media/disk-with-some-label it is 0755 instead of 0777. I checked that
/media/disk-with-some-label did not exist before starting the service.
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: systemd 237-3ubuntu10.24
ProcVersionSignature: Ubuntu 4.15.0-43.46-generic 4.15.18
Uname: Linux 4.15.0-43-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.7
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sat Jul 13 22:58:08 2019
Lsusb:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 04f2:b5ee Chicony Electronics Co., Ltd
Bus 001 Device 002: ID 058f:6387 Alcor Micro Corp. Flash Drive
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
MachineType: HP HP ZBook 15 G5
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-43-generic root=/dev/mapper/ubuntu--notebook--vg-root ro nomodeset nosplash
SourcePackage: systemd
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 08/07/2018
dmi.bios.vendor: HP
dmi.bios.version: Q70 Ver. 01.01.05
dmi.board.name: 842A
dmi.board.vendor: HP
dmi.board.version: KBC Version 15.2B.00
dmi.chassis.asset.tag: 5CD8394RP8
dmi.chassis.type: 10
dmi.chassis.vendor: HP
dmi.modalias: dmi:bvnHP:bvrQ70Ver.01.01.05:bd08/07/2018:svnHP:pnHPZBook15G5:pvr:rvnHP:rn842A:rvrKBCVersion15.2B.00:cvnHP:ct10:cvr:
dmi.product.family: 103C_5336AN HP ZBook 15
dmi.product.name: HP ZBook 15 G5
dmi.sys.vendor: HP
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1836461/+subscriptions
More information about the foundations-bugs
mailing list