4

I'm following this tutorial step by step,for

Here we clone the repo into a chmodded /var/www/[site_dir] folder. Note that we switch to the www-data user before running the git clone command. This is an important step because the deploy key we generated is owned by the www-data user and it will only work for that user, even if you are on the root.

I need to switch to www-data user, but when I try sudo su - www-data ( or sudo su www-data ) I faced with This account is currently not available.

I try ps aux and I see that the www-data user exists, Now I want to know how can I achieve that ? ( login with www-data user)

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Yuseferi
  • 400

1 Answers1

8

The www-data user is evidently configured with /sbin/nologin (or equivalent) as its shell, and thus the system will not allow you to login to that account. sudo lets you run a command as any user on the system, not just root. To clone the repo, you just need to sudo -u www-data git clone ... If you really need shell access as that user, sudo -u www-data bash will get you there.

Of course, this all depends on suitable settings in your sudoers file.

D_Bye
  • 13,977
  • 3
  • 44
  • 31
  • yes,I found the solution https://geekpeek.net/this-account-is-currently-not-available-login-problems/ – Yuseferi Jul 24 '16 at 10:40
  • @YusefMohamadi - Adding shell access for a service user is risky. https://unix.stackexchange.com/questions/155139/does-usr-sbin-nologin-as-a-login-shell-serve-a-security-purpose – txyoji Dec 18 '18 at 19:35