Linux directory permissions
I'm working with some third-party developers and I would like to grant SFTP (or FTP) access to the root folder for a website they're working on i.e.
'/var/www/html/website_abc' so that they could upload the files there. Note that I'm hosting my other websites there on the same EC2 instance e.g.
Just to emphasize that I'm working with multiple websites on 1 single EC2 instance, the structure of the websites are as follows:
My goals are as follows:
- User 'adeveloper' has access to '/var/www/html/website_abc' and only '/var/www/html/website_abc'
- I suppose user 'adeveloper' will use 'adeveloper@[my elastic IP]' as username to login to SFTP (or FTP), am I right?
- User 'adeveloper' do not have access to '/var/www/html/' or any other directories in my EC2 instance
- How about the private key file?
- Do I pass my private key file to the third-party developers - is it advisable to do so?
- Is there a way to generate a different private key file for them or allow them to log in with username & password instead?
I have done searches but most people were talking about how to access EC2 via SFTP which I'm already be able to using WinSCP.
- I would need 'adeveloper' to be able to upload stuffs to
/var/www/html/website_abcwhich is 'write' permission
- I would need 'adeveloper' to not have 'write' permission for any files/ directories under
/var/www/html/, and ideally not even 'read' permission
- However, there seems to be big problem here:
/var/www/html/already has permission 777 since this is my DocumentRoot folder. So, how do I stop 'adeveloper' from accessing my other website?
Partly solved I managed achieved my goals using OpenSSH (I create .ssh folder inside /var/www/html/website_abc/ and generate private key and give it to the third-party developers). I also learnt that I should never ever give the private key file AWS gave me. Still learning about chroot.