I am a total Apache noob, and after much hair-pulling and gnashing of teeth finally got SFTP access to new EC2 instance in passive mode. Can login only as "ec2-user", or "root" with no password, but not with myusername and/or password... I've created an .htaccess file in /home/admin, /home/ec2-user, and /home/myusername directories... I've tweaked /etc/httpd/conf/httpd.conf, /etc/vsftpd/vsftpd.conf as well as changed AWS security group settings and ports/protocols in accord with those tweaks, and created .ssh/authorized_keys file for each of the above user directories. I cannot drag/drop from local machine to EC2 instance via FTP client (Filezilla), so apparently, while I can login as ec2-user, I do not have write permissions. Suspect I need to chown...something?
I'm using the vsftpd set-up recommended here
Any ideas on what I need to change in order to 1) login via Filezilla as "myusername" rather than "ec2-user" or "root"?
PS: I've got most of the pertinent AWS command line tools installed and functional...
You have mentioned (and possibly confused) a few different things - so your objective isn't quite clear, unfortunately.
vsFTPd can be setup to use local users. To do so:
For SFTP (not using vsftpd!):
Now for the permissions issue you are facing:
Your options therefore are:
My recommendation would be SFTP with a certificate, and your home directories under /var/www/html
The specific commands for adding an SFTP user on Amazon's Linux:
Disclaimer: it is much more secure to use certificates than passwords - and you should keep PasswordAuthentication disabled.
To restrict your user to one directory (i.e. chroot):
Since the sftp-server will not be in your chroot path, we need to change it: Change (in sshd_config):
To:
Add the following to the end of your sshd_config (replace the path with, for instance, /var/www):
Restart SSH: