We have some accounts such as postfix,apache .. these account has “nologin” shell, meaning you can’t sudo su – apache or “su – apache”.
Sometimes we need to login to these account to run some commands to check some permission issues.
The solution is:
su -s /usr/bin/bash apache
(as you can see in the command, we explicitly provide the shell instead of using the system default)