1

I want to create a user in the FreeBSD for nginx that has:

  • No Login.
  • No home directory

how should I do that with pw useradd or any other tool.

4

It must have a home directory listed in /etc/passwd. Usually that will be whatever directory you store the web pages / config files in, though if you want to make sure it's a directory that doesn't exist, /nonexistent can be used instead.

To create a user that is not allowed to login, you would do two things:

  • give the user a shell that is not allowed to login
  • set the password to disallow login

This is how you do it:

useradd -c "Nginx server account" -d /path/to/directory -s /usr/sbin/nologin -w no nginx

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.