2

How can I restrict some users/groups to some directories? I mean different users, different directories.

  • What I have: Ubuntu 14.
  • Experience with Ubuntu: Just started.

What I have tried:

  1. I read this page. This was working till a bit extent, what the problem is that, the user can do things only in his folder/directory, which is read/write and edit, but the user can also go elsewhere, and open files and copy scripts from there, which can be risky as while having a game server on the VPS. He can't delete/edit or add files but can VIEW files other than his directory.

  2. And, then this page. This worked fine, but the problem is, I couldn't find a way to add more users to different directories. Like, I could only add one user to directory which was specified in sshd_config file. There is only one directory which can be restricted for one group. I want it to be flexible, able to add different users to different directories... groups.

Here is what I'm talking about: sshd_config

Subsystem sftp internal-sftp
Match group shooter
ChrootDirectory /home/shooter/shooter/mods
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

That shooter group can only access that ChrootDirectory. If I add different users to that group, they'll be able to view only that path. I want other users to view other directories, how is that possible?

Please help me, It's really important for me, as I've many game-servers to handle on a VPS, working with different developers.

1 Answers1

1

Change ChrootDirectory /home/shooter/shooter/mods to ChrootDirectory %h doing so you can restrict users of that groups to their home directory.

Subsystem sftp internal-sftp
Match group shooter
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

Follow this for write issue sftp_with_write_issue

Vinayak
  • 121