I'm using openSUSE Linux with KDE Plasma.

I'd like to set up two user accounts on the same machine, and have these two share part of the same Home folder.

In particular, I want to set up two user accounts that will be used only be me, a personal one and a work-related one; my concern is not to protect files from an account to the other, but to keep these two scopes separated.

I'd like each of these two accounts to share the basic system and desktop environments files and settings, in order to have a unified working environment, so if I change, I.E. some keyboard shortcuts or customize the way the system behaves, I don't have to do that twice. The settings that I'd like to be shared include applications related to the DE (Dolphin file manager, the terminal emulator).

I'd like to keep separated all the "user" files and applications that generally speaking don't fall under the "system" category. So, documents, pictures, etc.. but also the settings of programs like Digikam that don't natively support multiple user profiles.

I hope that all of this is clear. I can also settle on separate only the personal files and share all the settings (basically only the hidden files on the home folder).

Is it feasible to do so in a reasonable way? Or it will only result in a supreme mess?

  • Obviously you'd have to work out the permissions beforehand, but I guess you could use a KDE autostart script and/or/maybe a ~/.bash_login script in each profile that compares the hidden files in the home folder to the other one, decides which one is newer, and then overwrites the newer one to the other location. Another thought is to symlink both accounts' settings to one common location. It's definitely possible but also sounds like you would need to be somewhat selective, and it would need to be maintained over time. – BrianC May 16 '17 at 6:31

The simple solution would be to use symbolic links which are set up during log-in after creating both users with the same group and home directory and a umask of 0002.

Then create subdirectories $HOME/home and $HOME/work and create or move there the directories you want to be independent (eg mv $HOME/Documents $HOME/home, mkdir $HOME/work/Documents, etc).

Now in one of your log-in scripts (eg $HOME/.bashrc) check which log-in you are using and make the links:-

if "$(whoami)" == "WorkName"
then ln -sf "$HOME/work/Documents" "$HOME/Documents"
else ln -sf "$HOME/home/Documents" "$HOME/Documents"

That as I said is the simple solution, but its main disadvantage is that if you concurrently log in as the other user (using Ctrl-Alt-Fn, sudo -s, ssh) then it will either upset an existing session if it's an interactive log-in or access the wrong directories if not.

The only way I see round this is to have separate home directories for each log-in and setting up links for each file and directory that you want shared, but this will involve a lot more links and it will entail constant vigilance as each new shared file or directory is added, eg on the installation of new software packages.

| improve this answer | |
  • This seem to be an interesting solution. So, are you telling me that the only possible interference in this setup could be caused by a parallel login of the two accounts? Is going to work fine otherwise? – Sekhemty May 16 '17 at 19:03
  • I think so, but I lack the time to carry out an exhaustive test. I already share certain files and directories between my root and home account, but this is using the second method, and I need the occasional chown when I create new files from root (I am unwilling to add myself to the root group). – AFH May 16 '17 at 20:21
  • Ok thank you, I don't need you to test this, I don't really want to steal your time. I was just asking a clarification based on your current experience. I will try to test this as soon as I can – Sekhemty May 16 '17 at 20:56

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.