I am trying to figure out how to solve this problem: A batch on an unknown pc should login in to the server and download a file. (its rbash don't be worried).

The problem is, I dont know how to get over the password authentication. The use of a public key is also not possible because I would have to copy the file to the server in the first place.

Is there an alternative with password auth? I dont want to open insecure connections to the webserver.

running Debian.

  • how do you login to your server currently?
    – binarysta
    Apr 22, 2020 at 13:40
  • Over ssh/another account The account I want to use is restricted to only one folder Apr 22, 2020 at 13:46

1 Answer 1


I'm just going to take a moment to appreciate the cognitive dissonance between "A batch on an unknown PC should log in..." and "I don't want to open insecure connections".

Okay, so. Notwithstanding that: You do specify in the question that it's a web server. So on the web server put the file into a location accessible via HTTP(S). Then, on this unknown PC, you can:

$ wget https://hostname.example.com/path/to/some/snazzy_file


$ curl -o snazzy_file --silent https://hostname.exameple.com/path/to/some/snazzy_file

If you don't want anyone else to get the file, you can, since it's a web server, use a set of .htaccess and .htpasswd files (presuming Apache) or other means to lock down access to that file to either a range of client hosts or to a clients which provide authentication. If you decide to use HTTP Basic Auth, the URLs used for curl or wget would then be adjusted to: https://username:password@host.example.com/path/to/some/snazzy_file.


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.