1
mirror of git://git.acid.vegas/random.git synced 2024-11-14 12:06:38 +00:00
random/sftp-chroot

24 lines
583 B
Bash
Executable File

#!/bin/sh
USER="sftp"
mkdir -p /mnt/data/share
chown root:root /mnt/data/share
chmod 755 /mnt/data/share
mkdir -p /srv/ssh/jail
mount -o bind /mnt/data/share /srv/ssh/jail
echo "Add the following to your /etc/fstab :"
echo "/mnt/data/share /srv/ssh/jail none bind 0 0"
useradd -s /usr/bin/nologin -d /srv/ssh/jail $USER
passwd $USER
mkdir /etc/ssh/authorized_keys
chown root:root /etc/ssh/authorized_keys
chmod 755 /etc/ssh/authorized_keys
chmod 644 /etc/ssh/authorized_keys/*
mkdir /srv/ssh/jail/$USER
chown $USER:$USER /srv/ssh/jail/$USER
chmod 755 /srv/ssh/jail/$USER