I have a user account at my local library (they use openslx), in which I can store files. My actual home folder is "mounted" (I'm not sure how) in /home/[my_userID]/PERSISTENT instead of /home/[my_userID].

After logging in, an xterm window is started, the window manager is openbox. With logging out, everything not stored in PERSISTENT is deleted in /home/[my_userID]. (The complete message is shown below.)

When I change the configs of mousepad, e. g., the config file is stored in /home/[my_userID]/PERSISTENT/.config/Mousepad and I have to copy the file(s) manually for storing my configuration for the next session. To solve this, I've copied all the dotfolders from PERSISTENT to $HOME right after every login, but I'm sure there's a faster and way more elegant way to deal with this issue.

Is there a way to link to the dirs with a single entry in .bash_history ("command")?

ATTENTION: This is the non-persistent home directory!
Files saved here will be lost on shutdown.
Your real home is under /home/sj126/PERSISTENT
Please save your files there.
  • The question makes sense, but I don't get the title. What is the write-permissions about? It also does not match your goals, it seems to summarise the solution. Jun 23 '19 at 13:45
  • I really had trouble finding a (proper) title. If anyone could find a better one…?
    – Nepumuk
    Jun 26 '19 at 7:40
  • I make an improvement. Jun 26 '19 at 9:04

After some time, I've figured out that I could use symbolic links to speed up the configuration thing at least.

rm -dfr .cache .config .local&&ln -fs PERSISTENT/.bash_aliases PERSISTENT/.bash_history PERSISTENT/.bash_logout PERSISTENT/.cache PERSISTENT/.config PERSISTENT/.ICEauthority PERSISTENT/.local PERSISTENT/.ssh PERSISTENT/.vim PERSISTENT/.viminfo PERSISTENT/.vimrc PERSISTENT/.xinputrc PERSISTENT/.xsession-errors ~&&openbox --reconfigure&&gnome-terminal&exit

The command first deletes default dirs in /home/[my_userID] to bypass/circumvent a write error due to creating a link with the same destination/path (/home/[my_userID]/.config, e. g.) as an existing directory or file.

Second, the symlinks are created. This changes neither the behaviour or appearance of the session, nor that of programs (mousepad, e. g.).

Third, the window manager gets the new configuration, which is also stored in /home/[my_userID]/PERSISTENT/.config.

Fourth, a terminal with tabbing is started for a more comfortable session usage and the no more needed instance of xterm is terminated. Mind the single & in front of exit. A double one would exit your xterm not until your gnome-terminal is terminated.

To use this command, just store it in your /home/[my_userID]/PERSISTENT/.bash_history as your first command. Watch out to have an unlimited HISTFILESIZE in your /home/[my_userID]/PERSISTENT/.bashrc or a way larger one than you will need. Otherwise, the command will be lost when your maximum history size is reached. Having a time stamp for this command is optional.

I'm not sure right now wether you can easily change your configs with ln -s or wether you need ln for getting write permissions to your config files.

  • Using ln -f unfortunately doesn't work (but would let me change the config files directly in the programs without touching the files themselves) because the underlying folder PERSISTENT is located on another device, which leads to the error messages ln: failed to create hard link '/[…]' => 'PERSISTENT/[…]': Invalid cross-device link and ln: PERSISTENT/[…]: hard link not allowed for directory. So this solution seems pretty close although there's still some effort to make to solve the issue
    – Nepumuk
    Jun 26 '19 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.