How to use SFTP with Virtualmin


I change configuration of proftpd for use SFTP.

Bad part is I need to make this by Hand for every new server I add. And I want to have something like this but automatic created, Is possible?

"Configure Key Based Authentication
The ProFTPd can use SSH keys to authenticate users, but the keys must be converted to use the RFC4716 format. Luckily, the SSH suite has the ability to convert these files natively.

Begin by creating a directory to house these files:

sudo mkdir /etc/proftpd/authorized_keys

Now, we need to convert the public keys that are currently used to log into the server. If you only have one user, you can use this command:

sudo ssh-keygen -e -f ~username/.ssh/authorized_keys | sudo tee /etc/proftpd/authorized_keys/username
If you have multiple users and you need to separate their log in credentials, you will have to use the actual public key instead of the authorized_keys file, like this:

sudo ssh-keygen -e -f /path/to/ | sudo tee /etc/proftpd/authorized_keys/username_who_owns_k "