Assuming you don't have simultaneous sessions belonging to two different people. Your best bet use GNU stow to manage this. Stow is one of the most bizarrely useful packages, in the linux ecosystem. What it does is systematically manage groups of symlinks.
For your application you would create a directory that holds the dotfiles for all the people using the account within the user accounts home directory something like ~/.people. Then each person puts their dotfiles in a sub directory under the people directory. So e.g Smitty puts his vimrc or whatever in ~/.people/smitty. Nora puts all her settings files in ~/.people/nora and so forth.
On login each person runs
(cd ~/.people && stow $name)
Where $name is the name of the person's ~/.people directory
on logout run
(cd ~/.people && stow -d $name)
As for automating this their are ways to do it. There are shell scripts that run on login and logout on a per user basis called ~/.login and ~/.logout. Which would be the easiest way to do it. But automating this could lead to chaos. Last time i had something like this set up someone accidentally replaced ~/.ssh/authorized_keys. So my advice would be to avoid that.
If Multiple users at the same time
Then there is no sure fire way to do this, without fancy footwork. However programs use the $HOME environment variable to determine where the home directory is for configuration purposes. Your best bet is to use ~/.people/$name as before but instead of using stow have each user run HOME="~/.people/$name" bash -l
. This will create a new bash session with the home directory variable set to the per user sub directory and have it execute the same start up scripts as it would if you were logging in normally with the new home directory value. Thus fooling any program executed from the new bash instance which references the value of $HOME for it's config file locations into using the per individual directory instead of the top level home directory. This hack is extremely fragile, and doesn't work with all programs but this is really the best you can do with multiple people on at the same time.
sudo
(or evenssh localhost
in a pinch) into the common account for the "bunch of stuff [that] assumes"? – Ulrich Schwarz Feb 02 '20 at 11:32sudo
to run the special programs that have to be run as the-one user. – ctrl-alt-delor Feb 02 '20 at 16:40