2

Following this guide:

I set my /etc/fstab file in this way:

proc            /proc           proc    defaults             0       0
/dev/mmcblk0p1  /boot           vfat    defaults,ro          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime,ro  0       1
tmpfs           /tmp            tmpfs   nosuid,nodev         0       0
tmpfs           /var/log        tmpfs   nosuid,nodev         0       0
tmpfs           /var/tmp        tmpfs   nosuid,nodev         0       0

It works, but I have a problem with /tmp which has the following permissions:

stat -c "%a %n" /tmp
755 /tmp

As far as I know the default should be 1777, and I need this settings because I want to write some files there as normal user.

I tried to set the mode value in fstab:

tmpfs           /tmp            tmpfs   nosuid,nodev,mode=1777   0       0

with no effects. Of course chmod 1777 /tmp works fine but only until a reboot.

I'm running Debian Jessie on RPi3. What is the right way to set permissions on a tmpfs?

  • Do you have an initramfs, or startup script that might be mounting this before the script which mounts everything in /etc/fstab? – Patrick Jun 13 '16 at 5:07
  • Did you try to chmod /tmp when it's not mounted? To easily do it, just change fstab to use a temporary location, reboot, chmod 1777 /tmp, change fstab back, and reboot. I'm not sure it'll work but it might. – Julie Pelletier Jun 13 '16 at 5:29
  • Didn't the tidbits in man tmpfs work? – Ralph Rönnquist Jun 13 '16 at 5:40
  • The fstab line with mode=1777 is correct. Did you reboot after changing it? fstab is only read at boot time (or when you call mount on an entry with noauto), changing it doesn't affect already-mounted filesystems. – Gilles Jun 13 '16 at 21:47
  • @JuliePelletier that won't work. The "parent" directory has its own access rights, which get replaced once you mount anything on it. I usually do chmod 000 for dirs where appl filesystems get mounted, to prevent accidental writes into unmounted dir. – Marki555 Jun 14 '16 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.