# jailkit fails to find user in jail

## dr.nil

Hi,

I'm trying to set up a jail using jailkit. The jail setup looks sane to me but when I su to the user that has the jail set up I get:

 *Quote:*   

> Dec 14 17:19:39 localhost jk_chrootsh[25031]: now entering jail /home/xxx for user xxx (1002)
> 
> Dec 14 17:19:39 localhost jk_chrootsh[25031]: abort, failed to find user 1002 in /home/xxx/etc/passwd
> 
> 

 

of course the /home/xxx/etc/passwd contains that gid and the user and the permissions look sane to me, too.

I'm a bit at my wit's end how to do further debugging. Any tips?

----------

## Hu

Does dev-util/strace offer any insight?  My first guess would be that the process has called chroot successfully, but is still using pre-chroot paths, causing it to fail to find a file to search at all.

----------

## dr.nil

 *Hu wrote:*   

> Does dev-util/strace offer any insight?

 

No, unfortunately not ... would I see a chroot system call in the log? I would expect that but the log doesn't show which kind of supports your suspicion.

-dirk

----------

## Hu

I am not familiar with jailkit, but assuming it is based on using a chroot, then yes, you should have seen such a call in the strace output.  This is actually contrary to my suspicion.  I expected you would see these calls, possibly with other calls between them:

```
chroot("/home/user") = 0

open("/home/user/etc/passwd", O_RDONLY) = -1 (ENOENT)
```

Such a sequence would indicate that the application continued to use paths relative to the true root, after it had changed its root to the jail area.

----------

## dr.nil

 *Hu wrote:*   

> I expected you would see these calls, possibly with other calls between them:
> 
> ```
> chroot("/home/user") = 0
> 
> ...

 

I got it working now, although using a different route this time. I set up a second jail with shells and more user commands. I can enter that jail without any problem and it does for me what I want.

----------

