I am not sure what you are trying to achieve here but this statement of yours:
Quote:
Originally Posted by fanoflq
Obviously this is possible since each user's directory is owned by the user at boot time.
|
leads me to believe you are drawing conclusions based on false assumptions. The fact that each user's directory is owned by the user is not something that is being set up at boot time. It's being set that way at install time, or more precisely, at the time the user and his home directory is created. The ownership is stored in the filesystem in a persistent way that "survives" reboots.
In other words, my guess is that your problem might already be addressed by a simple
Code:
chown -R your_user:your_user /mnt/tempdir
(as root) right after you ran mkfs.ext4 and mounted the device.
I might be missing something here, though.
On a separate note, your other issue (running commands at startup with root privileges) can be solved in several ways:
- You can put a @reboot entry in to root's crontab
- You can add hooks to your init process (the way how to do this depends on your init)
- You can put the stuff into a script and make it sudo-executable with NOPASSWD permissions in the sudoers file. Make sure it is writable only by root for security reasons and then run it prefixed with sudo in your autostart config for your x session...
There are probably many pther ways. The .bashrc approach you suggested has the downside of being run every time you open a shell - seems like a bit of an overkill.
But again, for your specific issue I don't think any of this is needed. Just set the right permissions/ownership once and the result should be persistent across reboots.