Difference between revisions of "SFTP chroot + rsync"

From HoerupWiki
Jump to: navigation, search
(/etc/ssh/sshd_config)
Line 3: Line 3:
 
ChrootDirectory PLUS et traditionelt chroot. - en lyn-guide, nej nok nærmere notater.
 
ChrootDirectory PLUS et traditionelt chroot. - en lyn-guide, nej nok nærmere notater.
  
==/etc/ssh/sshd_config==
+
==SSH server==
 +
'''/etc/ssh/sshd_config'''
 
  #Subsystem sftp /usr/lib/openssh/sftp-server
 
  #Subsystem sftp /usr/lib/openssh/sftp-server
 
  Subsystem sftp internal-sftp
 
  Subsystem sftp internal-sftp

Revision as of 13:26, 18 February 2013

af Tommy d. 18. feb.

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

SSH server

/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/