Chrooted user does not start in his home directory and does not load his bash_profiles

Posted by Stuffy on Server Fault See other posts from Server Fault or by Stuffy
Published on 2012-10-15T11:50:24Z Indexed on 2012/10/15 21:40 UTC
Read the original article Hit count: 123

Filed under:
|
|
|

If the users logs in, he starts in / of the chroot (Which is /var/jail on the real machine). I would like him to start in his home-dir. Also, he seems not to load any of his profile-files (.bash.rc etc). I followed this tutorial to create the chroot environment. This is what my /etc/passwd looks like:

test:x:1004:1008:,,,:/var/jail/home/test:/bin/bash

this is what my /var/jail/etc/passwd file looks like:

test:x:1004:1008:,,,:/home/test:/bin/bash

I also found out that, if I remove

Match User test
    ChrootDirectory /var/jail
    AllowTCPForwarding no
    X11Forwarding no

from my /etc/ssh/sshd_config, the user starts in his correct home-folder and with his bash-settings loaded. However, he is able to leave the chroot-environment if I remove that part. This question I asked before is somewhat related, since I think the wrong look of the commandline is caused from the not loaded profile-files. So any ideas how to fix this?

© Server Fault or respective owner

Related posts about linux

Related posts about ssh