0

I want to add a second SFTP user that can only view a couple of folders/files in a home folder. I already added a group sftp_users for the normal users but now I am searching for a solution to add a read only user for the same folder.

muru
  • 197,895
  • 55
  • 485
  • 740
Koen
  • 1

2 Answers2

0

One solution might be:

  • Set a new group (e.g. sftp_users_ro)
  • Give the new sftp user the new group
  • set the following permissions to the folder: 775

The user and group which owner the folder will have read/write/execute permission in this folder.

The new sftp user will have read/execute permissions to the folder (without write permission)

See this Q&A for more info What is meaning of 755 permissions in Samba Share

Yaron
  • 13,173
  • Thanks for your answer! Can you help me with the exact commands that I need to use?

    Thanks in advance!

    – Koen Mar 03 '17 at 14:46
0

You can use ACLs (Access control lists). You can grant read access to an user with:

  setfacl -m u:lisa:r file

However, your sftp server needs to support, so check that out before trying. Also, there're some clients which don't support Linux ACLs (I might be wrong but I think WinSCP still doesn't support ACLs).

13dimitar
  • 935