uniq_

su was weird today

I can't login into some accounts on some of my GNU/Linux systems. eg. Because some of them are service accounts with no login shell, or simply because it's impolite logging-in to other peoples accounts.

But I needed to know whether one specific account was member of a group. Using sudo that's trivial.

sudo -u $USERNAME groups

Using su thou requires to also specify -p (aka. --preserve-environment).

su $USERNAME -p -c groups

Not hard either, but a bit unintuitive, especially when the error message just says: This account is currently not available.

written by uniq on 2018-07-13