This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sftp ssh chroot


I solved my problem regarding "jailing" users in cygwin. If anyone is interested, the patch for linux works fine for cygwin. Here are the steps:
1) Download http://chrootssh.sourceforge.net/patches/osshChroot-3.5.diff
2) Go to http://www.openssh.org/portable.html and get the sourcefile
openssh-3.5p1.tar.gz.
3) tar xzf openssh-3.5p1.tar.gz
patch -p0 < osshChroot-3.5.diff
cd openssh-3.5p1.tar.gz
./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/sbin
(Be sure to check that configure script, I can't remember the exact
command.)
make
make install
4) Now run ssh-host-config -y or however you would normally set it up.
5) Create a user with the shell script I wrote, or write your own.

#!/bin/sh
# add a caged ssh user
# usage sshuser username
# make a directory according to the username
if [ $1 ]
then
mkdir /home/$1
mkdir /home/$1/bin
mkdir /home/$1/home
mkdir /home/$1/usr
mkdir /home/$1/usr/sbin
mkdir /home/$1/tmp
cp /bin/bash /home/$1/bin
cp /bin/cp /home/$1/bin
cp /bin/cygwin1.dll /home/$1/bin
cp /bin/rm /home/$1/bin
cp /bin/mv /home/$1/bin
cp /bin/ls /home/$1/bin
cp /bin/cygcrypto.dll /home/$1/bin
cp /usr/sbin/sftp-server /home/$1/usr/sbin
echo "Remember to change /home/$1 to"
echo "/home/$1/./home in /etc/passwd"
else
echo "Usage sshuser username"
fi

6) Modify the users directory in /etc/passwd file to be
home/username/./home
7) Hope this helps, and sorry if someone already posted this although I
wish I had seen it if they had cause it would have saved me a lot of
trouble, although trouble can be a good thing when it's a learning
experience! =)
--
"Nothing would please me more than being able to
hire ten programmers and deluge the hobby market
with good software." -- Bill Gates 1976

We are still waiting ....


--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]