USER_HOME_DIR=export/home/testrssh
USER_NAME=testrssh
GROUP_NAME=testrssh
SCP_PATH=/opt/csw/bin/scp
RSSH_PATH=/opt/csw/bin/rssh
CHROOT_HELPER_PATH=/opt/csw/libexec/rssh_chroot_helper
LDD_PATH=/usr/bin/ldd
KSH_PATH1=/bin/ksh
KSH_PATH2=/usr/bin/ksh
PWD_PATH1=/bin/pwd
PWD_PATH2=/usr/bin/pwd
CopyLibFiles(){
for aFile in `ldd ${currExecutable} | cut -d' ' -f3`; do
if [ ! -d ${CHROOTPATH}/`dirname ${aFile}` ]; then
mkdir -p ${CHROOTPATH}/`dirname ${aFile}`;
fi
cp -p ${aFile} ${CHROOTPATH}${aFile}
done;
}
CopyExecutable(){
directoryPath=`dirname ${currExecutable}`
mkdir -p ${CHROOTPATH}${directoryPath}
cp -p ${currExecutable} ${CHROOTPATH}${directoryPath}
# copy sftp-server and library files
# ==================================
currExecutable=${SFTP_PATH}
CopyExecutable
CopyLibFiles
# make sftp-server suid root
# this only needs to be done if
# the user logging in doesn't own ${CHROOTPATH}
# chmod u+s ${CHROOTPATH}/${SFTP_PATH}
# copy scp and library files
# ==========================
currExecutable=${SCP_PATH}
CopyExecutable
CopyLibFiles
# copy rssh and library files
# ===========================
currExecutable=${RSSH_PATH}
CopyExecutable
CopyLibFiles
# copy rssh_chroot_helper and library files
# =========================================
currExecutable=${CHROOT_HELPER_PATH}
CopyExecutable
CopyLibFiles
# ==========================
currExecutable=${LDD_PATH}
CopyExecutable
CopyLibFiles
# copy ksh and library files
# =========================
currExecutable=${KSH_PATH1}
CopyExecutable
CopyLibFiles
currExecutable=${KSH_PATH2}
CopyExecutable
CopyLibFiles
# =========================
currExecutable=${PWD_PATH1}
CopyExecutable
CopyLibFiles
currExecutable=${PWD_PATH2}
CopyExecutable
CopyLibFiles
# copy file(s) from /etc
# ====================
mkdir -p ${CHROOTPATH}/etc
cp -p /etc/passwd ${CHROOTPATH}/etc
# =============================
mkdir -p ${CHROOTPATH}/${USER_HOME_DIR}
chown ${USER_NAME}:${GROUP_NAME} ${CHROOTPATH}/${USER_HOME_DIR}
echo "Remember to edit /etc/passwd with absolute path to jailed home dir: ${CHROOTPATH}/${USER_HOME_DIR}"
# ============
cp -p /usr/lib/ld.so.1 ${CHROOTPATH}/usr/lib/
# ========================
mkdir -p ${CHROOTPATH}/dev
cp -p /dev/null ${CHROOTPATH}/dev
From: [EMAIL PROTECTED] on behalf of Derek Martin
Sent: Tue 8/22/2006 2:36 PM
To: [email protected]
Subject: Re: chroot() failed, 2: Not owner
On Tue, Aug 22, 2006 at 02:36:00PM -0400, Martin, Russell wrote:
> > The user does not need to own the jail, and they don't need write
> > access to the root of the jail. The permissions on the jail just need
> > to be sufficient for them to read the directory, i.e. r-x.
>
> Okay. But, I've tested this and retested it and the behavior I've
> described is consistent. If sftp-server (the copy inside the jail)
> is suid root, then sftp works.
Sure, root can do anything... You are giving your users root
privileges within your jail. NOT GOOD!
> If sftp-server is not suid root and the user logging in owns the
> jail then things work. I have not found any other combination where
> sftp will work. This is a Solaris 8 box I'm testing on. Any ideas as
> to why things are behaving this way for me?
Well, it seems like it's almost certainly some kind of permissions
problem in your jail. For starters, with the sftp_server binary not
SUID (and of course the rssh_chroot_helper IS set SUID), does it still
fail with "chroot() failed, 2: Not owner"?
Without seeing your config, passwd file, and having access to the
directory permissions in your tree, I can't really make any guesses.
If you post your config, I can certainly poke at it... I don't
necessarily need to see your passwd file (which shouldn't have any
passwords in it, of course)... but that would help. And I'd
definitely need the output of this:
cd $ROOT_OF_JAIL; find . -type d -maxdepth 1 -exec ls -ld {} \;
My usual consulting fee is $100/hr, but since you packaged rssh for
Solaris, I'll give you the special price of $125/hr. ;-)
--
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ rssh-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rssh-discuss
