LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sftp jail with scp (https://www.linuxquestions.org/questions/linux-newbie-8/sftp-jail-with-scp-4175459404/)

slowerogue 04-24-2013 03:20 AM

sftp jail with scp
 
hi guys,
rhel6.3 64bit
i have setup a sftp jail
Code:

Subsystem      sftp    internal-sftp
# Example of overriding settings on a per-user basis
#Match User anoncvs
#      X11Forwarding no
#      AllowTcpForwarding no
#      ForceCommand cvs server
Match Group aaa
        X11Forwarding no
        ChrootDirectory %h
        AllowTcpForwarding no
        ForceCommand internal-sftp

and i added some users(/sbin/nologin) and they are belong to group aaa.
sftp jail working fine, but they cant run script with scp command.

by default sftp jail wont allow scp?
do i need to add them to ssh jail and give only scp features?
or is there any better way?
thanks

rosehosting.com 04-24-2013 03:45 AM

Try to create the jail using the following commands:

jk_init -v -j /home/jail_dir/ basicshell editors extendedshell ssh sftp scp

jk_jailuser -v -m -s /bin/bash -j /home/jail_dir/ jail_user

Do not forget to change 'jail_dir' and 'jail_user' with the actual jail directory and user.

slowerogue 04-24-2013 03:58 AM

hi, jk_init command not found.

i have tested like this
user A, sftp jailed, without sshjail,
when /sbin/nologin
cant ssh, cant winscp using scp,
can only winscp sftp

when /bin/bash
cant ssh, cant winscp using scp,
can only winscp sftp


user B, sftp jailed, ssh jailed
when /sbin/nologin
cant ssh, cant winscp using scp ,
can only winscp sftp

when /bin/bash
can ssh, can winscp using scp, can winscp sftp


i know i can give the users A sshjail,
but is this the only way?
am i on the right track?
thanks

rosehosting.com 04-24-2013 04:06 AM

Follow the instructions below to create an SSH chrooted jail using jailkit:

wget http://olivier.sessink.nl/jailkit/jailkit-2.15.tar.gz
tar -zxvf jailkit-2.15.tar.gz
cd jailkit-2.15
./configure
make
make install

mkdir -p /home/jail_dir
jk_init -v -j /home/jail_dir/ basicshell editors extendedshell ssh sftp scp

adduser jail_user
passwd jail_user

jk_jailuser -v -m -s /bin/bash -j /home/jail_dir/ jail_user


All times are GMT -5. The time now is 11:30 PM.