If you have followed our article Install WordPress on NGINX with FastCGI Cache in Ubuntu, you may noticed that when you try to login to FTP with default root or root privileged user, there are numbers of permission issue. Since we have assigned a www-data user for nginx, php5-fpm and the directory where we hosted all our web files, we need to assign the same user for FTP uses as well. So in this article I will guide you how to setup a www-data sftp user which will allows transfer to and from server. This Tutorial Explain www-data SFTP configuration.
1. User Setup
To access the server first step is to setup authenticate user. So lets set a password for www-data user.
sudo passwd www-data
You will be asked for entering a password for www-data user 2 times. Assign a strong one.
2. Setup Login Shell
Check Login shell for the user using…
grep www-data /etc/passwd
…in output you will see…
By default it is set to nologin as you can see in the output; so we need to change it to a login shell and we will do this by changing /usr/sbin/nologin to /bin/bash for www-data user from /etc/password file.
…and modify it to a login shell…
Now you have a working sftp user
3. Test SFTP User
FileZilla / CyberDuck / Transmit
Host: sftp://Server-IP-Address User: www-data Pass: Your-Password Port: 22
Now you can transfer files to server without any issue.
Leave a Reply