0

I want to setup SFTP server with special permisions, but i dont know whitch program IS the best, and most importantly, how to setup the idea

My idea: You access Via secure ftp protocol, and you can ONLY upload files, cant download,read, overwrite, delete

Is that idea possible ?

Thanks for your time.

1 Answer 1

4

First, create a directory to be accessible by user. Here user is just a local user. Replace it with whatever user you want

sudo mkdir -p /var/sftp/files

Change the ownership of the files directory to sftp user so that user can read and write on this directory.

sudo chown user:user/var/sftp/files

Set the owner and group owner of the /var/sftp to root. This will ensure that files can be uploaded only in one directory i.e. files and not in the parent directory.

sudo chown root:root /var/sftp
sudo chmod 755 /var/sftp

Now, edit the SSH config file

sudo nano /etc/ssh/sshd_config

Append these lines to the end of the file

Match User user
    ForceCommand internal-sftp
    PasswordAuthentication yes
    ChrootDirectory /var/sftp
    PermitTunnel no
    AllowAgentForwarding no
    AllowTcpForwarding no
    X11Forwarding no

Replace user with the username from above. Finally, save the configuration and restart SSH service

sudo systemctl restart ssh

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .