Using CHROOT jail in SFTP

Darren Tucker dtucker at zip.com.au
Tue Oct 24 09:36:08 EST 2006


John Monagin wrote:
> Good afternoon,
> 
> I have been using OpenSSH 3.8p1 and added code to sftp-server.c so I
> could put users in chroot jail. When I setup a new system and downloaded
> OpenSSH 4.4p1 and tried the same patch it fails with the following in

Unless you mention which patch you're using then the help that you get 
might be limited...

> the /var/log/messages file:
> sftp-server[11001]: fatal: Couldn't chroot to user directory
> /home/newyork/ftpbcc: Operation not permitted
> 
> I was wondering why one would work and the other would not.

The chroot(2) system call requires root privileges.  I suspect that the 
patch requires that you make sftp-server setuid root and that your new 
installation doesn't have that.  (Note that the code in the patch needs 
to be careful otherwise it might be able to be (mis)used by a user to 
elevate their privileges.)

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
     Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.



More information about the openssh-unix-dev mailing list