##SFTP server - shared folder access with restricted users
If you have followed part1 of this
article you would have seen me mentioning about a virtual client named RMP. we are going to discuss that requirement here and look into how we can set it up.
##Our Requirements:
4 Folders [ Data, Documents, Test, Logs ] exist in the top folder /sftp/home/rmp_inbound
4 internal users grouped as rmp_intgrp and they will have full access on the above mentioned folders
3 External users grouped as rmp_extgrp and they will have read access to the folder Data and Documents only and Test/Logs folder should be invisible
xferlog log format for file transactions and everyday log is kept under Logs folder for internal users access
Key based authentication
##Setup
####Create the folders
####Create Groups/Users:
We are going to create 2 groups and add the 7 users to thier respective groups as mentioned in our requirement
##Configuration:
If you are following the article in part1 proftpd.conf you would see that there is a reference to home folder configuration which jails the users to thier home folder.
####Jailed Home Folders
please take a look at the above link to look at the full config file, but the below bits are the important ones for this shared folder setup.
####Shared Folders Special ACL Enforcement.
If this little snippet is not included, both the internal/external users will have admin access
####Verify Configs and restart Service
The above setup will provide you a sftp server running on port 2022 with password based authentication, for which ever client if you prefer to enable key based authentication please drop the users key in /etc/proftpd/authorized_keys/ folder with as file name
####Key Based Authentication:
Drop the above key in /etc/proftpd/authorized_keys/ folder as rmp_intuser1 and rmp_intuser1 should now be able to login using key based authentication. Drop the keys for other users to enable login via key based authentication
NOTE: The above key generation is shown for example only and the clients should provide thier public key themselves
##Logging
####xferlog daily log requirement.
Since the logrotate for the whole sftp server logs is rotated weekly, we are going to use a script to give us daily logs just for the RMP client. The script can be placed under /opt/scripts and run daily at 01:00 hours