mounting UFS2 filesystem with access mode via fstab

Ian Lepore ian at freebsd.org
Sun Jan 21 19:25:13 UTC 2018


On Sun, 2018-01-21 at 20:00 +0100, O. Hartmann wrote:
> Am Sun, 21 Jan 2018 18:15:11 +0100
> Gary Jennejohn <gljennjohn at gmail.com> schrieb:
> 
> > 
> > On Sun, 21 Jan 2018 11:37:16 +0100
> > "O. Hartmann" <ohartmann at walstatt.org> wrote:
> > 
> > > 
> > > Recently, I ran into the problem mounting a newly created /tmp,
> > > when I switched back
> > > from a tmpfs-backed /tmp to a UFS2/SSD/HDD backed /tmp. 
> > > 
> > > The convenience to set mode=01777 for the memory/tmpfs backed
> > > /tmp seems not to exist
> > > for UFS2 backed filesystems, since manpage mount(8) doesn't give
> > > me any option
> > > provided via -o which could accomplish what I can achieve with
> > > mode=, see man
> > > tmpfs(5).
> > > 
> > > Well, I guess I do miss something here or is this achievement
> > > reached on a different
> > > path I'm unaware of?
> > >   
> > chmod 1777 /tmp as root
> > 
> Well,
> that is the way we do it usually. But is there now way to perform the
> settings via fstab
> entry? Look at man  tmpfs, man mount_msdosfs, for instance, they
> provide options which
> can be put into the option column of fstab.
> 

You don't need to do it via the fstab, because the permissions are
persistent in the filesystem.  Just mount the filesystem on /tmp by
hand, then chmod <whatever> /tmp after mounting it and then it will
always have those permissions (wherever it is mounted).

With tmpfs there is no persistent storage to keep the permissions, so
there must be a way to set it from fstab.  With msdosfs there is no way
to store the unix-style permissions in the fs, so there must be a way
to set it from fstab.  For UFS, the mode is just stored in the fs.

-- Ian



More information about the freebsd-current mailing list