I have 2 laptops at home, both running Ubuntu 12.04 (Desktop), and both using the same NetGear wifi router. I used a technique called "MAC binding" on one of the machines so that the router always assigns it the same 192.168.1.52 IP address every time it tries to connect to the Internet. (Unrelated: MAC binding just means configuring the router to always bind a specific MAC address to a specific IP.)
So now, I have 1 laptop that always gets assigned a random IP in the 192.168.1.1 to 192.168.1.50 range, and 1 laptop (my "build server") that always get assigned 192.168.1.52.
I am trying to write some bash script that I will run on the "client" laptop (the random IP machine) that will ssh
into the build server (192.169.1.52 machine); hence the necessity for the build server to have a "dedicated" IP from inside my LAN. I don't want to have to explicitly feed these bash scripts a password, so I followed the instructions in this article here to generate SSH keys. Specifically, I:
- Generate SSH keys on my client laptop (producing an
id_rsa.pub
file) - I
scp
'd theid_rsa.pub
file to my build server, andcat
'd it into the~/.ssh/authorized_keys
file. I verified that my client laptop's SSH key now exists inside theauthorized_keys
file on the build server. - I closed the terminal on my client laptop and then reopened a new one, just for good measure (in case Linux needs that in order to restart anything, etc.)
- I then tried to SSH into the build server, and am still being prompted for a password!
What's going on here? Why is SSH on my build server not honoring the authorized keys from my client laptop? Do I need to restart anything on the build server (sshd
, etc.)? Have I missed any crucial steps here? How to start troubleshooting? Thanks in advance!
Update:
Apparently Ubuntu doesn't have a /var/log/secure.log
, but does have a /var/log/auth.log
. When I tail this log on the build server, and then attempt to SSH into the build server from my client laptop, here's what happens:
- I run
ssh myuser@buildserver
from the client laptop - I am prompted for a password.
- As soon as I enter the password, I see the following output in the build server's
auth.log
file:
May 21 12:02:07 buildserver sshd[28930]: error: RSA_public_decrypt failed: error:0407006A:lib(4):func(112):reason(106)
May 21 12:02:10 buildserver sshd[28930]: pam_sm_authenticate: Called
May 21 12:02:10 buildserver sshd[28930]: pam_sm_authenticate: username = [myuser]
May 21 12:02:10 buildserver sshd[28930]: pam_sm_authenticate: /home/myuser is already mounted
May 21 12:02:10 buildserver sshd[28930]: Accepted password for myuser from 192.168.1.3 port 39821 ssh2
May 21 12:02:10 buildserver sshd[28930]: pam_unix(sshd:session): session opened for user myuser by (uid=0)
May 21 12:02:10 buildserver sshd[29003]: Received disconnect from 192.168.1.3: 11: disconnected by user
May 21 12:02:10 buildserver sshd[28930]: pam_unix(sshd:session): session closed for user myuser
Something that maybe I should have mentioned: on both machines (the client laptop and my build server, the username/account name is myuser
) - could Linux be getting confused because of the same username on both machines?
ssh-rsa
or---- BEGIN SSH2 PUBLIC KEY ----
?ssh-rsa
...is that my private key?ssh-agent
to manage your private key? Does it work if you useSSH_AUTH_SOCK=0 ssh buildserver
?