Filed under:

How do I change the FTP server to use SFTP?




 

Login to the server and recompile proftp:

 

cd /usr/local/directadmin/custombuild
./build update
perl -pi -e 's/proftpd=no/proftpd=yes/g' options.conf
mkdir -p custom/proftpd
cp configure/proftpd/configure.proftpd custom/proftpd/configure.proftpd
perl -pi -e 's/mod_tls/mod_sftp/g' custom/proftpd/configure.proftpd
./build proftpd

 

Edit "/etc/proftpd.conf" and change "Port" to new port number (i.e. 1122) and add the following section:

 

 

# SFTP Support
SFTPEngine      On
SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/ssh/ssh_host_dsa_key
SFTPClientMatch "WS_FTP" channelWindowSize 1GB
# enable for sftp debugging:
#TraceLog /var/log/proftpd/sftp-trace.log
#Trace scp:20 sftp:20 ssh2:20

 

Edit "/etc/proftpd.vhosts.conf" and for each VirtualHost section insert (comment out the bytes log in each VirtualHost entry):

 

SFTPEngine      On
Port            1122
SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/ssh/ssh_host_dsa_key

Edit "/usr/local/directadmin/data/templates/custom/proftpd.vhosts.conf" and add/merge the following:

 


        ServerName              "|ServerName|"
        AuthUserFile            |AuthUserFile|
        SFTPEngine      On
        Port            1122
        SFTPHostKey /etc/ssh/ssh_host_rsa_key
        SFTPHostKey /etc/ssh/ssh_host_dsa_key

Restart Proftpd

/etc/init.d/proftpd restart

 

Allow the port through the firewall (i.e edit /etc/csf/csf.conf and add to TCP_IN).

 



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
article icon What is MySQL? (Views: 2701)
article icon What is phpMyAdmin? (Views: 2259)

Language: