ramfs
was chosen specifically because there is zero chance of files being written to disk (swap space is used with tmpfs
). tmpfs
is out of scope for this question.
Here is my fstab
entry for the mount point:
ramfs /path/to/mount ramfs defaults,nofail 0 0
After mounting, I can set the permissions just fine:
chown -R myuser:myuser /path/to/mount
The problem comes after a reboot. The owner becomes root after reboot and it manually has to change back to my user. All I need to do is have the user id set at mount time (or persist through reboots).
Best Answer
ramfs has absolutely no mount options, so it isn't possible to set a mount uid/gid as it is with tmpfs.
From the man page:
Obviously you are aware of the danger of your system running out of memory and crashing because your user accidentally overflowed the ramfs, and you have accepted that risk. So we won't mention that tmpfs solves this problem, and is why ramfs hasn't gotten much developer attention and is rarely used. To quote the kernel developers:
The only way you can do this, therefore, is to continue to set the ownership after the filesystem is mounted, e.g. in
rc.local
.