I have a PHP script that I wish to run under the www account.

The account has nologin as shell and is used by Apache.

When I run "su -l www -s /bin/ksh" as root, I get the following message:

This account is currently not available.

I use OpenBSD 5.2

  • Does the account exist and is it unlocked and not expired? – peterph Mar 22 '13 at 20:38
  • Yes it is the account used by Apache, it has nologin as shell. – Maxime Vernier Mar 23 '13 at 8:22

www account is usually used for web server processes and direct login to shell is prohibited for security reasons. It is imperative it stays that way to prevent a hacking attempt on your website to get elevated rights on the server. just run

grep www /etc/passwd

and note the shell assigned to the account. It must be something like /bin/nologin or something to this sense. If you have root rights to this server, you can modify it but, I strongly suggest not to do such a thing. If you are just testing something, do it quickly and revert it back.

Of course this suggestion stands if you are running a public facing website on this server.

  • Indeed it has nologin as shell, I should have said that. I thought there was a way to su without touching to /etc/passwd content. – Maxime Vernier Mar 23 '13 at 8:24
  • su does functionally mostly the same as login does - i.e. checks password and spawns user's shell of choice (login shell if invoked with -l, at least on Linux) etc. If shell is nologin, then all you get is the error message (printed by nologin). – peterph Mar 23 '13 at 8:35
  • I was trying to change the shell with the -s parameter. – Maxime Vernier Mar 23 '13 at 16:50
  • if you have root privileges on this box and logged in as root, you can execute usermod -s /bin/bash www but if you are not root or don't have root access, you can not perform this action unfortunately. – MelBurslan Mar 23 '13 at 22:09

The simple option is to run your favorite shell as the user with a login shell behavior:

sudo -u www bash -l

Disadvantages of this:

  1. It has subtle differences from an actual login.
  2. It needs sudo as su uses the target user shell to exec the chosen shell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.