How to save custom user data to IGEL OS, where to save files?


Hi all,

we deployed “mousepad” for users who want’s to create some offline notes.

Learn more, read the entire thread inside the IGEL Community o Slack

Which path can they used for saving their notes on the IGEL OS? If they save them somewhere below /userhome it will be lost after rebooting.


Hi Eric, the best way would be to create a custom Partition with 50Mb and save it there. This one will stay persistent and don‘t represent a security issue.


So either, as @member said for a CP called something like /custom/Documents, or if the notes files are small (say 5 MB or so) then:

mkdir /wfs/user/Documents

ln -s /wfs/user/Documents /userhome/Documents


Thanks, I like Ron’s solution a little bit more.

What’s the best section to insert these commands? I also noticed that I have to change the permission of the folder with “chmod” to avoid access denied message.


@member just a note on storing stuff in /wfs: please never get out of sight that a filled up wfs mount point can result in undefined failures of IGEL OS.

Just keep in mind to check that in first place if something weird like restarting devices or if no profiles can be applied anymore. it has to stay on the level Ron described, <5mb


Maybe something like this…


It sounds like if the WFS partition is filled up with data, the IGEL may experience some seemingly “random issues”. Is there anyway to limit the user or set a disk quota for this purpose?


Well, there isn‘t even if it could be integrated. In the past wfs wasn‘t accessible from User because of Security issues, I‘m still thinking /wfs should be kept free of User interactions ☺️


I can see that the wfs partition is 512MB. At the moment there is only 2MB/512MB in used.

So alot of empty space. But again for these notes it should never neeed more then 5MB. Can you maybe give me a hint, how a user can simply delete a file in this folder?


Well, /wfs may look like 512MB… I think 25MB is real size… /wfs/ is not a “normal” filesystem, it has it’s own wfsd daemon. And mechanisms like file locks, .. doesn’t work as expected.


I was giving some thoughts how to implement a user quota within IGEL. One method could be to create a loopback file containing a filesystem (ie. fixed size of 2MB), and mounting this in the userhome space. It’s a bit more work to setup, but it will limit the user from being able to write more than the 2MB to this mount/directory. Something like Mousepad will show a “No space left on device” prompt when attempting to save when no space remains.

Negatives: more setup, it will occupy the full size (2MB) from the start, and it will be more steps to troubleshoot.

(This could also be used in the /custom partition to setup a “user quota”)

Any thoughts?

There are lots of comments/journal logging here, so it’s a little long.

“`# variables

vUserFile=”/wfs/user/loopbackfile.img”

vUserMount=”/userhome/Documents”

vUserLabel=”UserQuota”

vLogTag=”custom-filesystem-quota”

# create loopback file and filesystem, if it doesn’t exist.

# size 2MB = 512 bytes/block * 4096 blocks

if [ ! -f $vUserFile ]; then

dd if=/dev/zero of=$vUserFile count=4096

logger -it $vLogTag “create file: dd if=/dev/zero of=$vUserFile count=4096 [$?]”

mkfs -t ext2 -q -F -L $vUserLabel $vUserFile

logger -it $vLogTag “make filesystem: mkfs -t ext2 -q -F -L $vUserLabel $vUserFile [$?]”

chown user:users $vUserMount $vUserFile

logger -it $vLogTag “change ownership: chown user:users $vUserMount $vUserFile [$?]”

fi

# create mountpoint, if it doesn’t exist

if [ ! -f $vUserMount ]; then

mkdir -p $vUserMount

logger -it $vLogTag “create mountpoint: mkdir -p $vUserMount [$?]”

fi

# mount the loopback filesystem

mount -o loop,rw $vUserFile $vUserMount

logger -it $vLogTag “mount filesystem: mount -o loop,rw $vUserFile $vUserMount [$?]”

# change ownership of contained filesystem to user:users

chown -R user:users $vUserMount

logger -it $vLogTag “change ownership: chown -R user:users $vUserMount [$?]”

# Special readme notes for Users

cat <<EOF > “$vUserMount/_README.txt”

Some brief instructions for YOU!

Users cannot save edits to this file!

EOF

chown root:root “$vUserMount/_README.txt”“`


Nice… so much we can do on Linux…

Continue reading and comment on the thread ‘How to save custom user data to IGEL OS, where to save files? ‘.  Not a member? Join Here!

Learn more, search the IGEL Knowledge Base



Ask a question or comment on the above message thread?

Join or log in to the IGEL Community to ask us anything and meet other IGEL customers, partners, and EUC enthusiasts.

Submit a question, or Join Today!


Popular Message Threads


Categories & Tags: