I'm trying to append something to a file, from within a batch file. The file I want to append to is located on my Raspberry Pi, which I can SSH into.

To avoid having to enter my password every time, I would like to automate this in some way, either by putting it in the batch file (which doesn't seem to be possible, or people really don't like it), or by a shared key between my PC and the Rapsberry Pi of some sort.

I've tried running ssh-keygen on my PC, which works fine, and generates everything fine. I copied the public key to both /root/.ssh/authorized_keys and ~/.ssh/authorized_keys, but either way, I still have to enter my password when I try ssh in windows commandline (cmd).

To be clear: It's not like I'm getting a message about my keys being stored in an insecure location (I saw a lot of posts about people getting that error), I simply don't get any errors. When I call ssh Tim@RPiIP (also tried root@RPiIP) in cmd, I simply get prompted for my password, as if I never did anything with shared keys at all.

Am I simply misunderstanding how this is supposed to work, or is there something I don't know about that I should do? Also, are there any alternatives that I could use? I'm not at all bound to using these shared keys, anything that's simpler, even with plain text passwords is fine, since the scripts will never leave my PC, and the RPi is only accessible on the LAN anyway.

  • Is PubkeyAuthentication yes and is AuthorizedKeysFile .ssh/authorized_keys in /etc/ssh/sshd_config though?
    – Tom Yan
    Nov 13, 2019 at 10:22
  • I don't think so? Not 100% sure what you mean, but I've never seen anyone mention that in any tutorial / guide
    – Timmiej93
    Nov 13, 2019 at 12:49
  • Who cares about tutorial / guide. See sshd_config(5) (the man page), and your /etc/ssh/sshd_config, of course.
    – Tom Yan
    Nov 13, 2019 at 13:35
  • Well, I care about tutorials and guides, since I'm not bound to one specific system, and it's all a hobby, so if I see something mentioned in 10 different tutorials, I'll try it. For both of your suggestions: yes, they are in the config file. Both yes and .ssh/authorized_keys are the default values, hence why they're mentioned in every tutorial.
    – Timmiej93
    Nov 13, 2019 at 19:45
  • Now you want to make sure the files created really has the correct name (i.e. not authorize_key or authorised_keys or whatsoever. You may also want to set both PasswordAuthentication and ChallengeResponseAuthentication to no (and restart the ssh server), then see how it reacts then when you remote login (but you probably want to do that only if you have direct access to the pi though, for obvious reason). It might also have something to do with the configuration of your ssh client (especially when you are on Windows), or the key type it generated / used to authenticate.
    – Tom Yan
    Nov 14, 2019 at 3:27


You must log in to answer this question.

Browse other questions tagged .