I want to ask about the problem that I have with my office computer. I cannot reach the router so I cannot redirect any incoming requests to my PC. I have to get a huge file from another computer on the ethernet and the connection at the office; especially upload speed; is great therefore I want to serve a sftp server within my computer.

How can I redirect the incoming requests to my computer for the ssh port?

  • Any specific reason to use sftp instead of scp or rsync? Also, please clarify the sentences - it's difficult to read now. – l0b0 May 15 '13 at 11:19
  • Your question is a little bit unclear, could you clarify which computer is the source (of the file) and which computer is the destination ? Also do you really mean "on the ethernet" or "on the internet" ? – Xion345 May 15 '13 at 11:21

SFTP is provided by an SSH server. So install an SSH server on your PC. Most distributions activate SFTP by default when you install the SSH server.

The machine on which you're running the server needs to be accessible from the Internet: it needs to have a public IP address, or else the site router must forward requests on a certain port to it. If you can, open or forward port 22 on the router/firewall to your machine.

If you aren't authorized to open port 22 but can open another port, make the SSH server listen on some other port. For example, if port 443 (normally HTTPS) is possible, then add the line Port 443 to /etc/sshd_config (or /etc/ssh/sshd_config, wherever the configuration file is on your system) and restart the SSH server.

For what you're doing, instead of serving the file by SSH, you could serve it by HTTP. Run a trivial HTTP server that just serves files from one directory, for example python -m SimpleHTTPServer 1234 (to be executed from the directory where you're serving the files, 1234 is the port number). If the file needs to be confidential, encrypt it with GPG. To ensure the integrity of the file, write down its SHA-1 checksum (sha1sum /path/to/file) and verify it after downloading, or sign the file with GPG.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.