Skip to content

Instantly share code, notes, and snippets.

@ravnoor
Last active January 14, 2023 19:26
Show Gist options
  • Save ravnoor/3cd595879b82864abe65a7a0c28d1048 to your computer and use it in GitHub Desktop.
Save ravnoor/3cd595879b82864abe65a7a0c28d1048 to your computer and use it in GitHub Desktop.
unraid_proftpd_sftp.sh
# https://forums.unraid.net/topic/24356-proftpd-plugin-for-unraid-v68x/?do=findComment&comment=559588
# To enable sftp:
# open a shell on your unraid server and issue the following commands
cd /etc/ssh
ssh-keygen
# Enter the name of the keyfile (sftp_rsa_key) and no passphrase.
# You will get two files sftp_rsa_key and sftp_rsa_key.pub. The public
# key needs to be converted to another format to make it usable by
# proftpd:
ssh-keygen -e -f sftp_rsa_key.pub | sudo tee sftp_user_keys
# You will get a new file sftp_user_keys. Now the owner and permissions will need to be changed:
chown nobody:users sftp_rsa_key sftp_rsa_key.pub sftp_user_keys
chmod 600 sftp_rsa_key sftp_rsa_key.pub sftp_user_keys
# Now to make your system restore the correct permissions of this keys on boot you will need to modify the mountscript:
nano /boot/config/plugins/ProFTPd/mountscript.sh
# Insert the following lines:
chown nobody:users /etc/ssh/sftp_rsa_key /etc/ssh/sftp_rsa_key.pub /etc/ssh/sftp_user_keys
chmod 600 /etc/ssh/sftp_rsa_key /etc/ssh/sftp_rsa_key.pub /etc/ssh/sftp_user_keys
# Now edit your proftpd.conf file and insert:
<IfModule mod_sftp.c>
SFTPEngine on
Port 2222
SFTPLog /var/log/sftp.log
SFTPHostKey /etc/ssh/sftp_rsa_key
SFTPAuthorizedUserKeys file:/etc/ssh/sftp_user_keys
SFTPAuthMethods publickey
SFTPKeyBlacklist none
SFTPDHParamFile /usr/local/SlrG-Common/usr/local/etc/dhparams.pem
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment