Bug 1575 (KieronCurtis) - OpenSSH 5.2p1 failure using ChrootDirectory option on AIX
Summary: OpenSSH 5.2p1 failure using ChrootDirectory option on AIX
Status: CLOSED DUPLICATE of bug 1567
Alias: KieronCurtis
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 5.2p1
Hardware: PPC AIX
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-19 18:22 AEDT by Kieron Curtis
Modified: 2009-10-06 15:03 AEDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kieron Curtis 2009-03-19 18:22:42 AEDT
I have been experimenting with the ChrootDirectory feature on OpenSSH 5.2p1 running on AIX 5.3, but have encountered repeated failures
chroot("/restrict/home"): Operation not permitted.

Debugging the sshd process, it is the "chroot()" subroutine failing with error EPERM "Operation not permitted" because the process no longer has root user authority. Under AIX, the manual pages for the "chroot()" subroutine say "The calling process must have root user authority in order to change the effective root directory."

I believe the problematic code is located in the "session.c" module within function "do_setusercontext()". In this function, the "setpcred()" subroutine is called to change the user/group privileges from the root user to that of the ssh user. This is later followed by "safely_chroot()" (which invokes "chroot()"). Unfortunately the order of these calls wont work for non-root users on AIX. To make it work, the "safely_chroot()" must be called before "setprcred()".

Solaris has a similar restriction for "chroot()", viz: "The {PRIV_PROC_CHROOT} privilege is not asserted in the effective set of the calling process."
Comment 1 Kieron Curtis 2009-03-20 16:22:27 AEDT
This is also related to [Bug 1567] New: Insufficient privileges to chroot() on AIX.
Comment 2 Darren Tucker 2009-07-12 22:35:56 AEST

*** This bug has been marked as a duplicate of bug 1567 ***
Comment 3 Damien Miller 2009-10-06 15:03:18 AEDT
Mass move of RESOLVED bugs to CLOSED now that 5.3 is out.