2

Many times there are several "identities" which one user uses: for work, open-source, academia etc., all require different ssh keys, editor configurations, git configs etc.

I was wondering if there is any tool for switching between such "virtual profiles" with the same unix user. Preferably it will enable you to also have different default binaries/libraries (for example, in one profile "python" will run python2.7 while in other it will be python3).

I know there is an option to set it up using a combination of environment variables, aliases and linked files but I was wondering if there is a more clean option like virtualenv in python provides.

  • Why don't you want to set up each identity as a separate user? That seems like the most straight-forward approach. – PM 2Ring Oct 20 '14 at 6:21
  • 1
    I think that a different user is pretty "heavyweight" for this. I also like to have the same graphical interface for all (and not having one user use another user window manager), so it seems right for me. In addition, I want some things to be shared, both in configs and in running applications (one browser, for example). So in short, feels heavier than I want, but this is what I do now. – Beka Oct 20 '14 at 6:25
  • Most of these seem tied to resources used by a different "identity" rather than the identify itself. ssh lets you choose keys based on the host you connect to and which user you connect as; editor settings seem more specific to what file is being edited rather than who edits it, etc. – chepner Oct 20 '14 at 16:31
0

You could probably use git branches for this. Set your home dir up in a branch and then create another branch and configure this how you'd like for this other "profile". It would be a matter of switching branch and then you'd have effectively a different looking home dir. Then you'd probably need to source your environment or run another login shell.

I haven't tried this myself but I think it should work.

  • i think it could work. i you use symbolic links to most of your config files into some git repository, you don't need to put the whole home directory in source control. I just wished there was a tool that made this easier (switching branches and sourcing the environment). – Beka Oct 20 '14 at 13:43
1

iTerm 2's shell integration lets you define rules for profiles and automatically switch between them given the result of the rules. https://iterm2.com/shell_integration.html

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.