Linux – Switching users without the – symbol

commandlinuxrhelsu

I had to switch to a different user earlier for something that I was working on. I have originally done:

su support

While I was successfully able to switch to support, I found I was unable to make directories. So i exited out of support and this time I typed:

su - support

At that point, I was able to continue to make the directory. My question is: Why was I able to log in with the first command but unable to make directories? And also, if this be the case, what is the overall difference between using the "-" symbol and not using it? If needed, the distro I am using is Redhat.

Best Answer

The big difference is that - gives you the environment of the user you su'ed to. Chances are that you successfully became the support user, but were in your own home, which would explain why you were unable to create directories.

Related Question