^^ You are taking unnecessary trouble. I understand your question. The best bet is "sftp" & so I tried it. It works 100% as you want.
Here's a better version of that tute.
I have modified the tute as it contained a lot of flaws!! Here's the modified one ......
Quote:
1. Go to the end of this file emacs /etc/ssh/sshd_config and add:
# override default of no subsystems
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp# Example of overriding settings on a per-user basis
Match Group sftponly
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory %h
ForceCommand internal-sftp
2. Restart ssh: /etc/init.d/ssh restart
3. AS ROOT make a directory say "chroot" that will become root directory for sftp:
mkdir /home/chroot
4. groupadd sftponly
5. Create your user: useradd -d /home/chroot/ test
6. Remove SSH Access: usermod -s /bin/false test
7. Set your user to sftponly group: usermod -g sftponly -G sftponly test
|
username => test
Another thing you should remember is to
get openssh version >= 4.81 before starting the tute.
Next, /home/chroot will become your root directory (/) in sftp mode and will be readable and
not writable. Here comes the part which you want.
8. Create a directory in /home/chroot/ say "project1"
9. Own it to "test",
chown test.test project1
So with this, different directories can be assigned to different users (
read and write) to work on under sftp!! Create another user for another client say "test2" and a directory say "project2" and follow the steps 5,6,7,8,9 again.
Quote:
5. Create your user: useradd -d /home/chroot/ test2
6. Remove SSH Access: usermod -s /bin/false test2
7. Set your the user to sftponly group: usermod -g sftponly -G sftponly test2
8. Create a directory in /home/chroot/ say "project2" : mkdir /home/chroot/project2
9. Own it to test: chown test2.test2 project2
|
Thus, clients wont be able to read directories belonging to other projects/clients and they wont be able to browse the system directories tooo!!