rien / reStream

Stream your reMarkable screen over SSH.
MIT License
732 stars 56 forks source link

Permission Issues #64

Closed tholzschuh closed 3 years ago

tholzschuh commented 3 years ago

This is most likely on some failed configuration on my end, but weirdly reStream stopped working for me after not using it for like two months now and I didn't really change anything.

I tried reinstalling the most recent version of reStream (from the main branch, the version of today included) -- i.e. I also reinstalled the restream.arm binary on the remarkable.

When I start reStream, after entering my ssh password several times, I get the following output:

root@192.168.178.47: Permission denied (publickey,password).f=0/0 Input #0, rawvideo, from 'pipe:': 0KB vq= 0KB sq= 0B f=0/0 Duration: N/A, bitrate: 525657 kb/s Stream #0:0: Video: rawvideo (Y800 / 0x30303859), gray, 1872x1404, 525657 kb/s, 25 tbr, 25 tbn, 25 tbc nan M-V: nan fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0

Where might the "Permission denied" part come from? Did I miss to reconfigure something after my Remarkable made an update or something maybe?

tholzschuh commented 3 years ago

Oh I just realized: Using the script with the -o flag and recording a video into a file seems to work! Just using it in landscape/portrait mode doesn't really do anything...

danshick commented 3 years ago
Permission denied (publickey,password)

This is an ssh authentication issue.

tholzschuh commented 3 years ago

Mhm that's weird though. I can connect to the reMarkable using ssh root@192.178.168.47 ... Do you happen to know what might be off then @danshick ?

danshick commented 3 years ago

I think you've typed the IP address differently at least once in the issue. I would double check that. Although you've typed it flipped in one place where you claim it is working and typed it correctly in another where you were getting an error, so that could just be nothing.

"root@192.178.168.47" vs. "root@192.168.178.47"

Other than that, you could try adding -v (or -vv, or even -vvv) to https://github.com/rien/reStream/blob/main/reStream.sh#L87 to get more verbose output from SSH. That might help you track down what's going on.

Also, you must use a private key with how reStream is set up, not a password.

tholzschuh commented 3 years ago

Oh yeah I'm sorry about the IP addresses, I just typed them from memory the second time. That's not the issue...

So adding -v gives me this:

debug1: Server host key: ssh-rsa SHA256:dUMkk1mIzBJOBAj2MBJSS1tLTyvPysNf2xqIVbvltTY debug1: Host '192.168.178.47' is known and matches the RSA host key. debug1: Found key in /home/tim/.ssh/known_hosts:3 debug1: rekey out after 4294967296 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 4294967296 blocks debug1: Will attempt key: /home/tim/.ssh/id_rsa RSA SHA256:rkjsRc4zUY9W2Ay5O0uDgpIAK4aO2BIX+0cT5P+C3xE debug1: Will attempt key: /home/tim/.ssh/id_dsa debug1: Will attempt key: /home/tim/.ssh/id_ecdsa debug1: Will attempt key: /home/tim/.ssh/id_ecdsa_sk debug1: Will attempt key: /home/tim/.ssh/id_ed25519 ED25519 SHA256:+bgp/FY2Xv1bv9KQ+yWYFK0xL4F4GsG3zQDbVmhqT2k debug1: Will attempt key: /home/tim/.ssh/id_ed25519_sk debug1: Will attempt key: /home/tim/.ssh/id_xmss debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Offering public key: /home/tim/.ssh/id_rsa RSA SHA256:rkjsRc4zUY9W2Ay5O0uDgpIAK4aO2BIX+0cT5P+C3xE debug1: Server accepts key: /home/tim/.ssh/id_rsa RSA SHA256:rkjsRc4zUY9W2Ay5O0uDgpIAK4aO2BIX+0cT5P+C3xE nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0 0 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
debug1: Trying private key: /home/tim/.ssh/id_dsa debug1: Trying private key: /home/tim/.ssh/id_ecdsa debug1: Trying private key: /home/tim/.ssh/id_ecdsa_sk debug1: Offering public key: /home/tim/.ssh/id_ed25519 ED25519 SHA256:+bgp/FY2Xv1bv9KQ+yWYFK0xL4F4GsG3zQDbVmhqT2k debug1: Authentications that can continue: publickey,password=0/0
debug1: Trying private key: /home/tim/.ssh/id_ed25519_sk debug1: Trying private key: /home/tim/.ssh/id_xmss debug1: No more authentication methods to try. root@192.168.178.47: Permission denied (publickey,password).

I'm not really too fluent in ssh speak, so I don't really get what's the issue.

But I'm still very confused how reStream is able to run properly whenever I tell it to output the whole thing into a video file but it doesn't when just asking it to hand it to ffplay.. Does that make any sense?

danshick commented 3 years ago

I have no idea why it is working with one flag and not another, but this is clearly an SSH issue.

Can you paste the full text of the working and non-working commands here?

These lines imply that you have a public key that the remarkable will accept as valid, if you have the corresponding private key (likely /home/tim/.ssh/id_rsa). But your client never tries that private key. It may be a permissions error (ls -la /home/tim/.ssh would confirm) or maybe the file is just missing. Hard to say. None of this explains why one flag works and the other doesn't.

debug1: Offering public key: /home/tim/.ssh/id_rsa RSA SHA256:rkjsRc4zUY9W2Ay5O0uDgpIAK4aO2BIX+0cT5P+C3xE
debug1: Server accepts key: /home/tim/.ssh/id_rsa RSA SHA256:rkjsRc4zUY9W2Ay5O0uDgpIAK4aO2BIX+0cT5P+C3xE
rien commented 3 years ago

@tholzschuh you say:

When I start reStream, after entering my ssh password several times, I get the following output:

This means that your SSH key is not added to the authorized_keys-file of your remarkable. Can you please do that and try if it works then?

Using password authentication breaks reStream somehow because it cannot ask for a password with the ssh command fetching the image data. It probably has something to do with ffmplay inhibiting entering the password, because when the -o option is used, we launch the ffmpeg command (and not ffmplay).

tholzschuh commented 3 years ago

@rien mhm.. my authodized_keys contains exactly one key, and that has to be the correct RSA-key, as I can connect to the remarkable using ssh manually (I do have to enter my password for that as well; the RSA-key password that is, not the password of the remarkable).

Does reStream not supporting password authentication mean I have to use an ssh-agent automatically inserting my passwords for me or something?

(also weird: the same reStream script actually did work roughly 1-2 months ago, even thought I had to enter my SSH password several times as well)

Also thanks for taking the time!

rien commented 3 years ago

Ah yes, my previous assumption was incorrect. It is indeed the password on your ssh key that is the issue here, so you will indeed need to use an ssh-agent to cache your password in order to work.

It is weird that it did work for a while and then didn't. Have you changed anything regarding your ssh keys or ssh configuration in that timeframe?

tholzschuh commented 3 years ago

Ah alright, I see. Thanks for helping me figure this out!

Mhm.. I don't think so. I did change some SSH related stuff a while ago, but I'm pretty sure that was before reStream stopped working. Maybe my sense of time is tricking me though.

rien commented 3 years ago

I assume this issue is resolved. If this is not the case, please let me know.