Jailkit, jailing sftp users and scp problems



I needed a way to jail sftp users so I used jailkit 2.0. There are a
couple of good SOPs on the web for setting it up and for the most
part, my installations were flawless using these SOPs. However, I ran
into a problem this week dealing with sftp and scp on FC5.

At first, ssh worked fine for jailed users, but sftp and scp did not.
To get sftp to work, I needed to add /dev/null to the chrooted
environment. I edited sftp section in /etc/jailkit/jk_init.ini to
look like this:

[sftp]
comment = ssh secure ftp
executables = /usr/lib/sftp-server, /usr/libexec/openssh/sftp-server, /
usr/lib/misc/sftp-server
includesections = netbasics, uidbasics
devices = /dev/urandom, /dev/null

Then I ran jk_init -v /jail sftp
Sftp works!

Still had scp problems though. Scp kept complaining about "user
unknown". I had to use strace to finally find the problem. The
symbolic link for /lib64/libnss_compat.so.2 was missing in the /jail
directory. As root, I cd'd to /jail/lib64 and then created a link for
libnss_compat.so.2 to libnss_compat-2.4.so.

Scp works! Another symptom of this problem was when I ssh'd as the
jailed user and issued an ls -l, the effective uid and gid was showing
up instead of the user name and group name.

.



Relevant Pages

  • RE: sftp exit codes?
    ... thanks to everyone who replied with a tip or suggestion. ... Subject: sftp exit codes? ... I am using scp along with BatchMode on command line. ...
    (SSH)
  • Re: Does OpenSSH use RCP?
    ... > with someone about the difference between OpenSSH and SFTP. ... > SFTP) than SCP will fail. ... OpenSSH uses an implementation that is compatible to the original SSH ...
    (comp.security.unix)
  • Re: SFTP and SCP
    ... > Both scp and sftp use insecure protocols which derive their security from ... In what way do you see sftp as having "improved ... with wildcard expansion. ... matching rules chosen by the server. ...
    (comp.security.ssh)
  • Re: Howto deny a sftp connection
    ... > but that they cannot transfer files from that server. ... If you're allowing shell access then it's basically impossible to stop ... > Thats why I want to stop and deny all sftp and scp connections. ... the sftp subsystem is easily to stop by editing the sshd_config. ...
    (comp.security.ssh)
  • Re: FTP Encryption
    ... SSH as a transport in different ways, ... OpenSSH's sftp certainly doesn't use scp in any way. ... operating systems system files. ...
    (comp.security.ssh)