SFTP chroot + rsync

From HoerupWiki
Revision as of 13:24, 18 February 2013 by 87.104.25.187 (talk) (Created page with "''af Tommy d. 18. feb.'' ChrootDirectory PLUS et traditionelt chroot. - en lyn-guide, nej nok nærmere notater. /etc/ssh/sshd_config #Subsystem sftp /usr/lib/openssh/sftp-...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

af Tommy d. 18. feb.

ChrootDirectory PLUS et traditionelt chroot. - en lyn-guide, nej nok nærmere notater.

/etc/ssh/sshd_config

#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp

Match group sftponly
        ChrootDirectory /home/%u
        X11Forwarding no
        AllowTcpForwarding no
#       ForceCommand internal-sftp

Herfra skal alle homefolders både ha root som owner og group for at virke.

Klargør gruppe

addgroup sftponly

Opret bruger

adduser user01
addgroup sftponly
chown root:root /home/user01


Opret chroot miljø med bash og rsync

mkdir /home/user01/bin
cp /usr/bin/rsync /home/user01/bin/
cp /bin/bash /home/user01/bin/
mkdir /home/user01/lib
cp /lib/libncurses.so.5 /home/user01/lib/
cp /lib/libdl.so.2 /home/user01/lib/
cp /lib/libc.so.6 /home/user01/lib/
cp /lib/libacl.so.1 /home/user01/lib/
cp /lib/libpopt.so.0 /home/user01/lib/
cp /lib/libattr.so.1 /home/user01/lib/
mkdir /home/user01/lib64
cp /lib64/ld-linux-x86-64.so.2 /home/user01/lib64/