0

I have a need to set up an SFTP server which is multi user. The users in question have read-only access to their chrooted folders.

I need to be able to put files to these folders via SFTP with a different, administrative user account.

(For the purposes of this question I'll call my read-only sftp user example user1 and my member of sudoers admin account admin1)

I followed instructions here -

http://terminaltwister.com/setting-up-a-chrooted-sftp-server-on-centos-7-systemd/

but instead of chown root on the user's directory I did chown admin1

I could not log via sftp using the user1's credentials.

I then did chown root on the user's home folder (to follow more closely the instructions on the terminaltwister article) and was then able to log in as user1 via sftp, but when logging in as admin1 I was not able to put files to user1's folders.

I've disabled Root login via SSH (it's recommended) so I don't want to use root to put the files. I want to be able to put files to my users folders using admin1, and have each user be able to log in via sftp and have read-only access to their respective folder.

I can't quite wrap my head around how to do this. Can anyone advise?

1

I think I figured it out.

I created a new group...

sudo groupadd adminacces

Changed the group of the folder I want to write to

sudo chgrp adminaccess /home/user1/data

I added the admin1 user to the group that owns the folder I want to write to (the user account is NOT a member of that group)

sudo usermod -a -G adminaccess admin1

Then I set the group, but NOT the owner of the folder to have write access.

sudo chmod 575 /home/user1/data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.