The wrong way to sudo su, and the right way

I've never had a formal training on Linux. My knowledge comes from my experience working on it for the last 12 years, but some things I've just learned as simple recipes and never bother looking them up.

One such thing was changing users with sudo. I've been doing it as:

sudo su <user> -

Notice the dash at the end, which makes provides a "real" environment for <user>, just as if I would have logged in with that user, directly.

But this has ceased to work properly, apparently due to a bug fix in Linux TTY.

The error that I got was:

tibi@localhost:~$ sudo su zope -                                  
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

The solution is to switch the position of the dash, to:

sudo su - <user>

Comments