1

I have two unison profiles with the same name as following:

/root/.unison/theprofile.prf
/home/users/itsme/.unison/theprofile.prf

Both have different contents. They target the same remote server (over SSH), but have their own directory on that server.

I execute the following:

sudo unison theprofile

I expected that the profile in /root/.unison/theprofile.prf was taken, but some reason I do not understand the profile in /home/users/itsme/.unison/theprofile.prf was taken.

Why is that? How can I allow root to have its own unison profile, without conflicting the profile of itsme (and vice versa)? Ideally, they don't even know anything from each other.

itsme_now
  • 13
  • 2

1 Answers1

2

When you use just sudo, you switch the user, but you keep the environment variables from the old user. So the config file from itsme is used, because that's still the current home directory.

If you want to completely switch to root, including all environment variables, you have to run sudo with the -i parameter so it creates a login shell.

sudo -i unison theprofile

Then it will use the profile from the root home directory.

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89