FTP / SFTP

How to use goshs as FTP or SFTP server

goshs can serve files over FTP or SFTP using the -ftp flag. By default -ftp activates a plain FTP server on port 2121. Adding -ftp-sftp switches to SFTP mode instead.

Plain FTP

# Start plain FTP server on default port 2121
goshs -ftp

# Start on a custom port
goshs -ftp -ftp-port 2121

Connect with any standard FTP client:

ftp <your-ip> 2121

SFTP

Adding -ftp-sftp switches the same entry point to an SSH-based SFTP server. Authentication is required in SFTP mode — either username/password with -b user:pass or an authorized keys file with -fkf <file-path>. Both options can be used together.

Info

The embedded SSH server generates a fresh host key on every start, which will produce a host key mismatch warning when reconnecting. Generate a permanent host key with ssh-keygen -f ./goshs_rsa_key -N "" -t rsa and supply it via -fhk goshs_rsa_key to avoid this.

The SFTP server also respects -ro (read-only), -uo (upload-only), and the web root set with -d.

# Password authentication
goshs -ftp -ftp-sftp -b user:password

# Public key authentication
goshs -ftp -ftp-sftp -fkf ~/.ssh/authorized_keys

# Both methods, read-only, permanent host key
goshs -ftp -ftp-sftp -b user:password -fkf ~/.ssh/authorized_keys -ro -fhk ./goshs_rsa_key

# Custom port
goshs -ftp -ftp-sftp -ftp-port 2022 -b user:password

Connect with any standard SFTP client:

sftp -P 2121 user@<your-ip>