Saturday, April 30, 2011

Some experiences scp'ing to Haiku

Today I tried to copy a file from my Mac to Haiku on my Dell E520.
The command I used on the Mac was simply

scp some.file user@

However, this produced this error message
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /Users/paulfxh/.ssh/known_hosts to get rid of this message.
Offending key in /Users/paulfxh/.ssh/known_hosts:4
RSA host key for has changed and you have requested strict checking.
Host key verification failed.
lost connection

Well, the reason for this was clear because most of the OSes I use on the Dell E520 have the same internal IP (
I had already generated an RSA key for another OS with the same IP which meant that Haiku's key for this IP was not the one in /Users/paulfxh/.ssh/known_hosts
Luckily, this is easy to resolve as pointed out in this thread. Just open the known_hosts file and delete the line (usually a very long line which stretches to the next IP or the end of file if there are no other IP's after the one you're deleting.
After this, just reboot and try the scp command again.

Incidentally, to run the TextEditor on my Mac to edit the known_hosts file, which is in a hidden directory (.ssh), I found it more convenient to issue this command from a terminal:
open -a /Applications/ "/Users/paulfxh/.ssh/known_hosts"

[Edit: Actually, it's a lot easier to use this format
open -e .ssh/known_hosts

The -e switch specifies TextEdit and as I was already in my home directory, I didn't need to include /Users/paulfxh/ in the file specification. Additionally, it seems the quotes around the file spec are not needed.
So, the total characters to be typed has been reduced by nearly two thirds from 68 to 24.

Before running the scp command, and although I'd been using Haiku for a number of years, I realized that I knew neither the username nor the password. This is simply because it's not required to login and I've never had any occasion to need it, until now.
Finding the username is easy.
Either run this command in a terminal

or run this one, again from a terminal
cat /etc/passwd

Both provided the Haiku username as user although the second included sshd too.
OK, but what about the password?
I don't believe any OS allows you to discover the password for a user. However, you can change the password and that's what I did using this command
passwd user

this asked me to key in the new password and then repeat it, and that was it.
Now, I can scp to Haiku.

No comments:

Post a Comment