Tuesday, February 02, 2010

su: permission denied or the wheel of misfortune

I am not a Linux guru, but sometimes I need to use Linux systems and for that I use SSH. It is customary nowadays that one doesn't login remotely using the root account, but rather use another user, then use the command su (super user) to gain root priviledges. I've done it tens of times, most of the time checking if I can log in and then su with the new user.

Well, a few days ago I did not and, to my horror, I noticed that I couldn't use su from my new user, as a permission denied error message popped up. Plus, I had already locked the user I had previously logged in with. Add to this that the device in question had no keyboard/monitor jacks, it was remote, it only had a serial connection, my laptop did not and that the serial cable I tried to use with a borrowed desktop computer was not good enough for this damn device and you can understand the hell I was in.

Enough said, the idea is that some Linux distributions (like the ones based on BSD. Gentoo, for example) use what is known as the wheel group or the group that permits users to use su. Use usermod -G wheel myNewUser to add your user to the wheel group and always ALWAYS check if you have enough permissions for login users before you log off from root.