1

I have followed these instruction to setup a SFTP server on an Ubuntu EC2 instance

https://rmtheis.wordpress.com/2011/07/03/setting-up-an-sftp-site-on-amazon-web-services-ec2-creating-an-account-to-share-with-a-third-party-and-restricting-that-account-to-allow-only-sftp/

But When I connect using filezilla using a keyfile I don't have write permission to the remote folder. If I add write permission for the group the user is in (chmod 775 Files) then I can add and remove files but if I disconnect I am unable to reconnect and get this error in Filezilla.

Error: Network error: Software caused connection abort

Error: Could not connect to server

In my /etc/ssh/sshd_config I have this line

ChrootDirectory /home/%u/Files

Here is what I do on the command line:

chmod 775 /home/christian/Files

After this I cant connect from Filezilla but if already connected can write to Files folder

If I do this instead:

chmod 755 /home/christian/Files

I can connect from Filezilla but cant write to Files folder.

How is it possible that adding write permission to the Files folder causes connection problems and what do I need to do to be able to connect and write to the server?

4
  • Just so I'm clear are you attempting to use filezilla with the same account you restricted to using read-only ftp?
    – Elder Geek
    Sep 25, 2016 at 18:34
  • It looks like you didn't exactly follow that guide - in particular, you made the ChrootDirectory a subdirectory of /home/%u - my knowledge of SFTP jails is sketchy, but doesn't that mean /home/christian needs to be owned by root? Also, as noted in the comments the installation of vsftpd is redundant (it provides FTPS, not SFTP) - not sure how much I'd trust a guide that confuses that. Sep 25, 2016 at 18:38
  • Possible duplicate of Failed to SFTP connection
    – Jakuje
    Sep 26, 2016 at 7:56
  • Thanks for the input. I'm not sure that is a duplicate. Sure it mentions that All components of the pathname must be root-owned directories that are not writable by any other user or group. After the chroot, sshd(8) changes the working directory to the user's home directory. but that is the case where I have used chmod 755 to take write permission away from the group and left it on root which is the owner. This then leaves it in a state where anyone in the group cant write to the folder.
    – chrisp_68
    Sep 26, 2016 at 8:15

1 Answer 1

0

Ok, so this was actually easy to solve. I made a sub folder in Files and changed ownership to root:mygroup then added write permission for the group

You must log in to answer this question.

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