Score:0

how to configure a user's home to reside in a loop device?

cg flag

I'm trying to configure our guest account to reside in a loop device mounted to /home/gast.

On startup the loop device gets created via this line in /etc/fstab:

tmpfs /home/gast tmpfs size=3g user

in /etc/profile I entered the procedure to copy the content of a preconfigured user into the mounted loop device via:

chown gast:gast /home/gast && cp -r /home/gast-default/ /home/gast && chown -R gast:gast /home/gast*

On reboot it turns out, that /etc/profile doesn't seem to have root privileges any more. I get error messages complaining about missig permissions and in the end a virgin home directory for the guest user. This isn't helping because my guests have almost no experience on PCs yet alone Linux. The structure in /home/gast-default/ copes with that

Question: How and where do I enter the copy procedure earlier than /etc/profile? Before Systemd it used to be /etc/rc.local, but apparently this isn't supported any more.

Thanks Waldgeist

Score:1
cn flag

/etc/profile is a file that is sourced when you log in. That is why the changing of user and copying does not proceed. /etc/profile is sourced for each user, whereas ~/.profile is user specific.

The "modern" way is to create a systemd service that does that.

More easy will be to create a crontab entry for the root user, that does the copying @reboot.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.