How to access the "www"-folder on my machine via sFTP

March 21, 2014 10.1k views
Hello :) I'm new to the whole server world and usually just transfered my files via FTP to the server. With the great tutorials on digitalocean I managed to setup a LEMP server with cakephp. This is great, though I'm curious, how would I create access to the "/usr/share/nginx/www" folder on my machine via ftp? I managed to connect with FileZilla to my server, though I end up in my user-folder "/home/USERNAME/files" :/ I'm thankful for every kind of information to help me understand this new world :)
7 Answers
Change the directory you are in try to browse to "/". Also look for the ".." folder at the top of list of folders, double click to go up 1 folder level, repeat as needed to reach "/"
I can only access the user-folder and the "files"-folder. Clicking on the ".."-folder doesn't do anything :/
looks like you have created a custom user.

now you need to be sure about giving permissions to this user.

did you follow this tut:

you need to be sure to give the user some permissions to access your WS.

if you are done, then you will be able to go through the whole WS tree to see all listed files and folders.

to give your user a permission to a folder do this:

sudo chown -R my-user:www-data /folder-name

my-user: is the user you want to give permision,
www-data: is the group your user belong to.

you can use it like this: sudo chown -R youruser:youruser /folder-name

then enter this command:

sudo chmod -R 0755 /folder-name

here you will give the permission to the user to access the folder(s) with writing + reading + executing

Important, you need to be careful where to use these commands!!

if I were in your situation,I will do this:

I will give permission to user to this folder only: www

so I have to go inside the folder with puTTY or DO console -->

cd /usr/share/nginx

it will be like this:

user@yourhostname: /usr/share/nginx$
then I can enter the command like this:

sudo chown -R my-user:my-user ./www

Then this command:

sudo chmod -R 0755 ./www

and you're done!

Good luck!!
by Etel Sverdlov
This tutorial covers how to login with root, how to change the root password, how to create a new user, how to give the new user root privileges, how to change the port, and how to disable root login in. This tutorial is written for Ubuntu. When you first create your server, this tutorial explains the first steps you need to take. This tutorial is written for Ubuntu 12.04.
Hello FMCB and thank you for your detailed answer :)
I'm now able to connect to the server with WinSCP and upload files :)

If you don't mind, I have two additional questions:

1. does every user that gets created belong to the group "www-data" automatically?

2. I changed the home-folder for my created user in "/etc/passwd" to the www-folder, is this bad practice?

Again, thank you!
glad to hear things worked for you!!

ok, for the 1st question, the answer is:

simply, no. you need to modify users groups after creating them. like this:

to add an existing user to a group use this command:

usermod -a -G groupName userName

you can check here:

I think this guide will help understand things better:

for the 2nd question, yes, it is a bad practice, but only for one reason. if you don't have that folder on your home tree folder, that user may not get into function. so the system is going to consider it invalid user.

so it is better to change it after changing the user folder name. you can do that like this:

mv /home/user/oldname /home/user/newname

make sure there is one space between these two paths.

you can check it out here:

then you can look at your /etc/passwd to see if changes took place or not. if not, possibly you need to reload your system by logout and login to see the changes in effect.

no need to logout from puTTY if you use it, just open new puTTY console and see if things changed!!

Good luck!
Have another answer? Share your knowledge.