Docker SFTP server
I had a couple of files I needed to provide to a friend on a regular basis.
- The files were too big to email.
- The files would change every week.
- They were created/stored on my NAS.
- Neither of us wanted to go through the hassle of using Dropbox/Google Drive/etc.
Simple solution was for me to create a simple Docker container so he could use SFTP to grab them off my NAS:
docker run -v /mnt/VD01/files:/home/bob -p 2222:22 -d atmoz/sftp bob:supersecretpassword:1001
Files were stored on my NAS in /mnt/VD01/files and with that being mapped to the bob user's home directory of /home/bob.
The SFTP server would run on the standard port 22, but Docker would map that to port 2222
The username is bob, with his password being supersecretpassword
His userID would be 1001.
In this case Bob would simple set up a SFTP connection, specifying port 2222, instead of the default port 22. Docker would map that to the port 22 the actual SFTP server is running on.
Easy enough to do in Filezilla, etc, but if Bob is using the command line, it would look like this, assuming that sftp.example.com would resolve to my server's public IP:
sftp -P 2222 bob@sftp.example.com