Well, here are the steps I’ve done; the problem is listed at the bottom.
sudo mkdir /home/test sudo useradd test sudo chown root:test /home/test sudo chmod 755 /home/test sudo groupadd testgroup sudo useradd -G testgroup test sudo useradd -G testgroup other
Then I edited
/etc/ssh/sshd_config and added the following to the end, so the user will only be able to view their home directory
Match group testgroup ChrootDirectory %h X11Forwarding no AllowTcpForwarding no ForceCommand internal-sftp
then I restarted SSH (
sudo /etc/init.d/ssh restart)
After this I wanted to have this user be able to edit some other files in another user's home directory, so I used this command to mount it and give it permissions.
sudo mount -o bind /home/other/share /home/test/share sudo chgrp -R testgroup /home/test/share sudo chmod -R g+rwx /home/test/share
The share directory is owned by other, but the group is testgroup (users test & other). (Octal rwxrwxr-x 0775)
But my problem is that the test user can't modify any files in the share directory (/home/test/share)
Edit: output from some commands (logged in as
uid=1000(server) gid=1000(server) groups=1000(server),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),124(sambashare),1001(testgroup)
drwxrwxr-x 21 server testgroup 4096 Jun 23 16:36 .
drwxr-xr-x 5 root root 4096 Jun 19 16:56 ..
drwxrwxr-x 7 server testgroup 4096 Jun 23 16:35 folder