delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/12/09:39:32

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3DF8A091.2000402@sohowireless.com>
Date: Thu, 12 Dec 2002 09:43:29 -0500
From: Jeremy Hein <jeremyh AT sohowireless DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, jeremyh AT sohowireless DOT com
Subject: 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019