Www-data SFTP User Setup

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.

nano /etc/passwd

…and modify it to a login shell…


Now you have a working sftp user

3. Test SFTP User

SSH Test

ssh www-data@server-ip-address

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.

Published by AtulHost

Creator of AtulHost. An ardent Linux user. Comes from a business management background. Loves to do research on modern business insights and enterprise solutions like career, education, finance, investments ideas, marketing strategies, and productivity skills; technological trends like automation, artificial intelligence, cloud and edge computing, computer hardware and networking, data science, and the internet of things.

Join the discussion

Required fields are asterisked and email address will not be shared.

Ensure a friendly atmosphere to site members and visitors. Encourage the freedom of expression and exchange of information. Let the discussion meaningful. Comments that are off-topic or spam will be deleted.