Logging in as the apache user (www-data) is useful when trying to figure out permission denied errors. I always first check that I can access the files when I am logged in as that user. Unfortunately, with ubuntu 14.04, unlike 12.04, the www-data user is set to not allow login, so you need to run the command(s) below.
sudo sed -i 's;www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin;www-data:x:33:33:www-data:/var/www:/bin/bash;' /etc/passwd sudo su su www-data
Hi
ReplyDeleteHow can I roll back the changes ?
Just open the file
Delete/var/www:/bin/bash
and change the line
www-data:x:33:33:www-data:/var/www:/bin/bash;
to
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
I think the file should be /etc/passwd, not /var/www:/bin/bash :)
DeleteThe file being edited is already /etc/passwd, the /var/www you see is the home directory of the www-data user.
DeleteThanks Stuart!
ReplyDelete