mount ramfs as user
Solution 1
I had the same problem. Using mode=777
instead of umask=777
as an option seems to work (Ubuntu 15.10).
Solution 2
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.)
Related videos on Youtube
Jonathon Reinhart
Professional C, asm, Python developer GitLab, FreeNas admin
Updated on September 18, 2022Comments
-
Jonathon Reinhart over 1 year
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
. -
Jonathon Reinhart over 12 yearsI should have mentioned it, but I can't use tmpfs. tmpfs can be paged out to disk, which I need to avoid.
-
Bryan Hunt about 12 yearsIncorrect, ramfs has a max size option
-
redanimalwar over 9 years@BryanHunt source? Because I read this everywhere. "A ramfs derivative called tmpfs was created to add size limits"
-
DepressedDaniel over 7 yearsExcept 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.
-
Neurotransmitter over 7 yearsThis 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 removeddefaults
since it somewhat contradicts touser
(it implies plenty of other options) and tunedmode
to a more safe world-non-readable0770
mask (so onlyroot
andjreinhart
may read and write to this).