Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)

Thanks,


Edit: output from some commands (logged in as test user):

id –a
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)

ls –la
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

share|improve this question
    
Can you post the output of groups (and/or id –a) and ls –la commands for the test user? –  Scott Jun 22 '13 at 3:46
    
@Scott id -a uid=1000(server) gid=1000(server) groups=1000(server),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),1‌​24(sambashare),1001(testgroup) ls -la rwxrwxr-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 –  blaize9 Jun 23 '13 at 22:48
    
Thanks for the information, but it doesn’t quite seem to match what you posted before. I was expecting to see /home/test owned by root:“test” and mode 755, but you show it owned by “server”:“testgroup”, mode 775. I was expecting to see a /home/test/share, owned by “other”; you show a subdirectory called “folder”, owned (also) by “server”. And why, when user test runs id –a, does it says that his uid is “server”? –  Scott Jun 24 '13 at 0:56
    
@Scott sorry about the delayed response, I was away from home for the past week. I redone all the steps again on a VM and it worked fine. But when i tried it on some older files and for some reason I get this error on WinSCP "error occurred while setting the permissions and/or timestamp" looks like a permission problem that is only effecting older files. -rwxrwxr-x 1 other testgroup 0 Jul 1 15:56 test.txt -rwxrwxr-x 1 other testgroup 7 Jul 1 16:05 test.txt –  blaize9 Jul 1 '13 at 21:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.