su

su: This account is currently not available.

# su apache ./script
This account is currently not available.

It's because in /etc/passwd is set as a nologin user:

apache:x:81:81:added by portage for apache:/var/www:/sbin/nologin

and /sbin/nologin returns the error message.
Simply speaking, su isn't compatible with /usr/sbin/nologin.

What you want to do, instead, is run the command under the given user using sudo:

$ sudo -u apache ./script

su

Allows users switch to another user, and log in as that user.

Syndicate content