Why does SFTP return "permission denied" even when user has highest privileges?

that seemed to work-> sftp .. garyfiles@127.0.0.1 (on the same muchine)
I want to implement an FTP over two Linux(Ubuntu 20.04) munchies in order to allow a user to upload files into my server without giving him/her permissions to do anything else on the server side.

*will specify constraints the end alongside fixes I already tried *

The method I chose to do it is by creating a new user on the server side and restrict its access to one directory.

So on server side:

sudo adduser garyfiles
mkdir -p /var/sftp/uploads
chown root:root /var/sftp
chmod 755 /var/sftp
chown garyfiles:garyfiles /var/sftp/uploads

and edited and appended the sshd_config file to Match user with ->

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

at this point I restarted sshd -> systemctl restart sshd
and on client sidesftp user@{user_IP}

When trying to execute sftp user@{user_IP} I am prompted to user password, once supplied I get "Permission denied, please try again."

Already tried and didn't help:

  1. change ownership of ~/upload to root for max permissions
  2. creating a new users group and assigning it garyfiles and root users
  3. creating a new group for original, garyfiles and root users.
  4. change privileges of upload to allow full access to every one: chmod 664 /var/sftp/upload
  5. sftp -v did not return valuable clues..

Constraints to consider and assumptions I can make:

  1. SFTP would utilize password authentication (and not SSH)
  2. user must not have access to other folders on the machine
  3. Both devices would be connected to the same LAN
5 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like