Using SFTP

Last updated: October 24th 2024

Using SFTP on Webdock Stacks

SFTP is actually built in to the SSH daemon which is installed on Ubuntu, so using SFTP is simply a matter of adding a shell user with the correct group assignment and then connecting. You may need to watch out for permission issues however. Here are the steps on how to use SFTP on a typical Webdock stack in order to work in the web root:

Creating Shell User

Create a Shell user in Webdock where you set the user group to "www-data"

Screenshot from 2024-10-24 16-14-19.png

 

At this point you will be able to read files, but probably not write any files and you will experience permission issues

In order to solve the write permission issue, you need to issue the following command on your server. SSH (or use WebSSH) into your server and run:

# sudo chmod -R g+rw /var/www/html

This command basically says "Recursively give Read and Write access to anyone in the group which owns the file or directory, starting in /var/www/html"

This all assumes you have not modified your web root in any way, or changed ownership of your web root. If you have, modify the commands and group above accordingly. 

We have made a script which issues the Group Read/Write permission command against /var/www/html which you can find in the Script Library

Remember, you can also disable regular FTP entirely if you feel it is a security risk. Click here for more information.

Configuring Authentication

Either enable Password-based authentication or configure your FTP client to use your Key File

To enable password authentication:

In the shell users screen, check the second box and apply the settings.

Screenshot from 2024-10-24 16-17-26.png

To use your private key:

In your FTP client, you need to input your private. In this case, we were using Filezilla so this is where you should add your private key, and you should use this key.

Screenshot from 2024-10-24 16-28-17.png

Now you should be able to connect to your server with your FTP client.

Screenshot from 2024-10-24 16-26-56.png

Note: The host field should should include "sftp://" at the beginning as you see in the screenshot. And the port field should be 22 (or any other port that SSH on your server listens on)

That's it!

Contact Webdock Support if you need assistance.