random- collection of un-sorted bollocks |
git clone git://git.acid.vegas/random.git |
Log | Files | Refs | Archive |
sftp-chroot (583B)
1 #!/bin/sh 2 USER="sftp" 3 4 mkdir -p /mnt/data/share 5 chown root:root /mnt/data/share 6 chmod 755 /mnt/data/share 7 8 mkdir -p /srv/ssh/jail 9 mount -o bind /mnt/data/share /srv/ssh/jail 10 11 echo "Add the following to your /etc/fstab :" 12 echo "/mnt/data/share /srv/ssh/jail none bind 0 0" 13 14 useradd -s /usr/bin/nologin -d /srv/ssh/jail $USER 15 passwd $USER 16 17 mkdir /etc/ssh/authorized_keys 18 chown root:root /etc/ssh/authorized_keys 19 chmod 755 /etc/ssh/authorized_keys 20 chmod 644 /etc/ssh/authorized_keys/* 21 22 mkdir /srv/ssh/jail/$USER 23 chown $USER:$USER /srv/ssh/jail/$USER 24 chmod 755 /srv/ssh/jail/$USER