I've setup a chroot environment for one of my users called client on my system. I'm using WINSCP to connect to my server from my machine using public key authentication. Everything works fine, I can login, see the home directory (jail directory) and cannot navigate upwards.
The issue I am having at the moment is that I cannot copy files to the server from my local machine. When I do that I am getting Permission denied : Cannot create remote file /home/client/test.txt
My server is a Red Hat server and this is my sshd configuration:
Match User client ChrootDirectory %h PubkeyAuthentication yes AllowTCPForwarding no X11Forwarding no ForceCommand internal-sftp
I've looked online for this and I've found some notes regarding making copies of the
lib folder on the client's home directory, but those solutions didn't help.
All I need at the moment is for the user to be able to copy files from their local machine to my server under their chroot folder.
Here is a quick description of what I have done:
I have a chrooted user (username: clientd) which I've jailed inside their home directory. This chroot directory is
/home/client/ which is owned by root.
Now I need this client user to be able access the tomcat web application folder which is residing under
What I've done is:
- chroot the user with a public key of their own to the home directory.
- Create a folder under
tomcat_ROOTand given the ownership to
Now when I run the command:
$ mount --bind /mnt/datadrive/tomcat/webapps /home/client/tomcat_ROOT
The folder disappears from the directory listing inside
/home/client if I login with client. My root user can see it but not the desired user.
Here are some permission listings:
ls -l /home/client/tomcat_ROOT:
drwxr-xr-x. 6 root root 4096 Apr 11 15:07 . drwxrwxr-x. 12 root root 4096 Apr 11 15:07 .. drwxr-xr-x. 3 root root 4096 Apr 9 22:10 webapp1 drwxr-xr-x. 4 root root 4096 Mar 18 18:43 webapp2 drwxr-xr-x. 3 root root 4096 Apr 9 22:11 webapp3 drwxrwxr-x. 10 root root 4096 Apr 11 15:20 ROOT
ls -l /home/client/:
drwx------. 4 clientdev clientdev 4096 Apr 10 21:36 . drwxr-xr-x. 7 root root 4096 Apr 10 22:07 .. -rw-------. 1 client client 664 Apr 10 21:43 .bash_history -rw-r--r--. 1 client client 18 Apr 23 2012 .bash_logout -rw-r--r--. 1 client client 176 Apr 23 2012 .bash_profile -rw-r--r--. 1 client client 124 Apr 23 2012 .bashrc drwx------. 2 client client 4096 Apr 10 19:20 .ssh drwxr-xr-x. 2 client client 4096 Apr 10 21:34 tomcat_ROOT