My fstab entry:

none    /home/jreinhart/ramdisk    ramfs    defaults,user   0 0

The directory before mounting:

drwxrwxr-x  2 jreinhart jreinhart  4096  Oct 17 11:31 ramdisk

The directory after mount ramdisk:

drwxr-xr-x  2 root     jreinhart  4096  Oct 17 11:31 ramdisk

So, you can see the problem. Once I mount, the owner changes to root, and the group permissions go to r-x so I cannot use this ramdisk. What gives?

I'm trying to do this without having to su.


I had the same problem. Using mode=777 instead of umask=777 as an option seems to work (Ubuntu 15.10).

  • This is the sole right answer. So the OP's fstab entry may look like this: none /home/jreinhart/ramdisk ramfs user,noauto,size=1024M,mode=0770 0 0. I removed defaults since it somewhat contradicts to user (it implies plenty of other options) and tuned mode to a more safe world-non-readable 0770 mask (so only root and jreinhart may read and write to this). – TranslucentCloud Nov 23 '16 at 18:58

Assuming this is Linux, you could also use tmpfs (see here for differences, i.e., why it might be advisable to use tmpfs), which is explained here and (see link) supports the options mode, gid and uid. There's the following paragraph in tmpfs.txt which might also be relevant:

These options do not have any effect on remount. You can change these
parameters with chmod(1), chown(1) and chgrp(1) on a mounted filesystem.

So maybe a sudo chown ... is still needed (I guess not, but I'm not quite sure about this, sorry.)

  • 1
    I should have mentioned it, but I can't use tmpfs. tmpfs can be paged out to disk, which I need to avoid. – Jonathon Reinhart Oct 17 '11 at 16:51

If you want to avoid sudo you could use the automounter here (service autofs). Look for executable automount-maps. There you can script anything you want before, during and after the actual mount.


It is generally somewhat dangerous to give non-root acces to a ramfs mount, since a (malicious/ignorant) user could put enough data into it to fill all available system RAM. Like others above have mentioned, something like tmpfs or even a ram disk might be more desirable for non-root use. (sr_'s post has some really good reads.)

  • 1
    Incorrect, ramfs has a max size option – Bryan Hunt May 9 '12 at 18:44
  • @BryanHunt source? Because I read this everywhere. "A ramfs derivative called tmpfs was created to add size limits" – redanimalwar Nov 8 '14 at 16:33

After you mount the ramdisk, /home/jreinhart/ramdisk becomes the root of the mounted filesystem. Apparently this directory is owned by root. Change it (and any other relevant file on the ramdisk) once and for all to be owned by jreinhart.

You may have seen a different behavior for filesystems like vfat. On filesystems that have no notion of ownership, the filesystem driver tries to come up with sensible fake ownership, generally making every file owned by the user who mounted the filesystem. Filesystems like ramfs that provide normal unix permissions expose them directly.

  • Except that it's not "once and for all" as the ramfs contents are lost when it is unmounted. OP probably wants the permissions to persist across reboots, which is why he is giving us an fstab entry to look at. – DepressedDaniel Nov 20 '16 at 20:43

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.