SFTP restricted user (Debian Jessie)


I need to create a user who could upload files to a web root folder /var/www/mysite (Debian Jessie, Apache 2.4) via SFTP . I tried to accomplish this task in accordance with the Linode guide (https://www.linode.com/docs/tools-refer … and-ubuntu">https://www.linode.com/docs/tools-reference/tools/limiting-access-with-sftp-jails-on-debian-and-ubuntu).

/etc/ssh/sshd_config file: Subsystem sftp internal-sftp

Match Group sftp_users

ChrootDirectory %h

X11Forwarding no

AllowTcpForwarding no

ForceCommand internal-sftp

Restart OpenSSH

$> sudo addgroup --system sftp_users

$> sudo adduser webboss

$> sudo usermod -G sftp_users webboss

$> sudo chown root:root /home/webboss

$> sudo chmod 755 /home/webboss

$> cd /home/webboss

$> sudo mkdir docs

$> sudo chown esljwebboss:sftp_users *

The Linode guide (like many others) ends as "Your users should now be able to log into their accounts via SFTP and transfer files to and from their assigned subdirectories."

But it never happened. Until I created manually a /home/webbos/.ssh folder and a authorized_keys file with my public key inside.

Is this step missed in the guide, or did I miss something?

Thank you

1 Reply

Could be the guide assumes that SSH password based logins are enabled on the server and your SSH is setup for key based logins, which is what you really want anyway.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct