Question

Setting up extra ftp account

I am setting up an Ubuntu-LAMP droplet with SSH access. Now I want to provide someone else (S)FTP access to this droplet. But I don’t want to give him the SSH key. Instead I just want to give him a username and password that I can easily withdraw later on.

How can I do this?

Subscribe
Share

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.

Accepted Answer

You just need to add an account with useradd. This article has the steps in detail:

https://www.digitalocean.com/community/tutorials/how-to-enable-sftp-without-shell-access-on-ubuntu-16-04

Cheers

I followed the recipe that unixynet linked to. However, I am running into some obstacles. I want to give somebody access for technical support so he would need the full rights to a website (but not the other on this server). The example creates a special directory and gives the visitor its ownership but that is no option for me. I need to give full rights to something of which the visitor is not the owner.

What I did now was:

  • adduser visitor

And then I have adapted the /etc/ssh/sshd_config file by adding:

Match User visitor
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /home/mysite/public_html
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no

I can connect in FTP with the user’s name and password but then it gives an error message that it cannot retrieve the folders

Hey friend,

Great question! You can have them generate their own SSH key and then add their public key to your authorized_keys file on the droplet (/home/user/.ssh or /root/.ssh). If you need them to have root access, note that while you can remove their SSH public key from the authorized_keys file at any time, there may be no way to know what backdoors they’ve left for themselves. Never let anyone you don’t trust in with root or sudo access.

Setting up a privileged user with only access to what they need makes more sense, but there’s no one size fits all instruction for doing it because every situation varies. For example, needing them to access a folder will be different than needing them to read/write a folder that is also able to be read/written by an active service.

Jarland