A simple SFTP server for testing
In this post, we will be running a sftp server we’ve build to be as simple as possible. It’s open source, made from a single binary and so bare bone it fits in a single file with less than 100 line of code, leaving you a bit of room to extend it for your needs (or not) with no headache so you can enjoy the rest of your day.
If you’re looking for a fully featured SFTP server with all the bells and whistles check our guide on setting up a full fledge SFTP server.
So let’s get on with it:
Step1: download the sftp binary
~/$ curl -O https://archive.kerjean.me/public/2022/sftp.bin
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4892k 100 4892k 0 0 601k 0 0:00:08 0:00:08 --:--:-- 943k
~/$ chmod +x sftp.bin
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4892k 100 4892k 0 0 601k 0 0:00:08 0:00:08 --:--:-- 943k
~/$ chmod +x sftp.bin
Step2: run it
~/$ ./sftp.bin
Listening on [::]:2022
Listening on [::]:2022
That’s it, you’re done, you can already connect to the server to make sure everything is fine:
~/$ sftp -P 2022 anonymous@127.0.0.1
The authenticity of host '[127.0.0.1]:2022 ([127.0.0.1]:2022)' can't be established.
RSA key fingerprint is SHA256:+/SnmXxy1tzUaKaosZNUZf+edw8dZ8GIOzCBXyKjQcI.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[127.0.0.1]:2022' (RSA) to the list of known hosts.
anonymous@127.0.0.1's password:
Connected to 127.0.0.1.
sftp> pwd
Remote working directory: /home/mickael/Downloads
The authenticity of host '[127.0.0.1]:2022 ([127.0.0.1]:2022)' can't be established.
RSA key fingerprint is SHA256:+/SnmXxy1tzUaKaosZNUZf+edw8dZ8GIOzCBXyKjQcI.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[127.0.0.1]:2022' (RSA) to the list of known hosts.
anonymous@127.0.0.1's password:
Connected to 127.0.0.1.
sftp> pwd
Remote working directory: /home/mickael/Downloads
If you have a hard time converting everbody to the CLI, check our SFTP client the people you work with will love: