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/uploadsand 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 noat 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:
- change ownership of ~/upload to root for max permissions
- creating a new users group and assigning it garyfiles and root users
- creating a new group for original, garyfiles and root users.
- change privileges of upload to allow full access to every one:
chmod 664 /var/sftp/upload - sftp -v did not return valuable clues..
Constraints to consider and assumptions I can make:
- SFTP would utilize password authentication (and not SSH)
- user must not have access to other folders on the machine
- Both devices would be connected to the same LAN