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

  • Posted March 21, 2014

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 :)


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thank you :)

Thank you :)

glad to hear things worked for you!! <br> <br>ok, for the 1st question, the answer is: <br> <br>simply, no. you need to modify users groups after creating them. like this: <br> <br>to add an existing user to a group use this command: <br> <br>usermod -a -G groupName userName <br> <br>you can check here: <br> <br> <br>I think this guide will help understand things better: <br> <br> <br>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. <br> <br>so it is better to change it after changing the user folder name. you can do that like this: <br> <br>mv /home/user/oldname /home/user/newname <br> <br>make sure there is one space between these two paths. <br> <br>you can check it out here: <br> <br> <br> <br>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. <br> <br>no need to logout from puTTY if you use it, just open new puTTY console and see if things changed!! <br> <br>Good luck!

Hello FMCB and thank you for your detailed answer :) <br>I’m now able to connect to the server with WinSCP and upload files :) <br> <br>If you don’t mind, I have two additional questions: <br> <br>1. does every user that gets created belong to the group “www-data” automatically? <br> <br>2. I changed the home-folder for my created user in “/etc/passwd” to the www-folder, is this bad practice? <br> <br>Again, thank you!

looks like you have created a custom user. <br> <br>now you need to be sure about giving permissions to this user. <br> <br>did you follow this tut: <br> <br> <br>you need to be sure to give the user some permissions to access your WS. <br> <br>if you are done, then you will be able to go through the whole WS tree to see all listed files and folders. <br> <br>to give your user a permission to a folder do this: <br> <br>sudo chown -R my-user:www-data /folder-name <br> <br>///explanation:/// <br>------------------------- <br>my-user: is the user you want to give permision, <br>www-data: is the group your user belong to. <br> <br>you can use it like this: sudo chown -R youruser:youruser /folder-name <br> <br>then enter this command: <br> <br>sudo chmod -R 0755 /folder-name <br> <br>///explanation:/// <br>------------------------- <br>here you will give the permission to the user to access the folder(s) with writing + reading + executing <br> <br>Important, you need to be careful where to use these commands!! <br> <br>if I were in your situation,I will do this: <br> <br>I will give permission to user to this folder only: www <br> <br>so I have to go inside the folder with puTTY or DO console --> <br> <br>cd /usr/share/nginx <br> <br>it will be like this: <br> <br>user@yourhostname: /usr/share/nginx$ <br>then I can enter the command like this: <br> <br>sudo chown -R my-user:my-user ./www <br> <br>Then this command: <br> <br>sudo chmod -R 0755 ./www <br> <br>and you’re done! <br> <br>Good luck!!

I can only access the user-folder and the “files”-folder. Clicking on the “…”-folder doesn’t do anything :/

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 “/”