SFTP
How to use goshs as SFTP server
You can use goshs to also provide the files using SFTP by using -sftp
. The default SFTP port is 2022 and can be changed using -sp
.
Authentication is required using SFTP. You can use either username and password authentication with the flag -b user:pass
or you can use an authorized keys file with -skf <file-path>
. The options can be used exclusivly or together.
As the embedded ssh server will generate a host key everytime you run it you will get error messages when connecting two times to the SFTP server when rerunning the binary. You can generate a permanent host key by running ssh-keygen -f ./goshs_rsa_key -N "" -t rsa
and then providing the host key file to goshs using the command flag -shk goshs_rsa_key
.
The SFTP server also supports the command flag read-only -ro
to make the SFTP connection read-only and upload-only -uo
to make the SFTP connection upload-only. And it also will take different web-roots (-d
) into account, as well.