Archive for category Ubuntu
An IP Address changed and now I can’t pull with Mercurial! Hjelp!
Posted by Stuart in Troubleshooting, Ubuntu, unix on September 21, 2010
No worries! There are a few things you can do to resolve this speed bump in your race to code. I’ll walk you through a sample “WTF?!” session and the resolve things as we go along…
1. You run
hg pull
and get an error like this:
remote: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ remote: @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ remote: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ remote: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! remote: Someone could be eavesdropping on you right now (man-in-the-middle attack)! remote: It is also possible that the RSA host key has just been changed. remote: The fingerprint for the RSA key sent by the remote host is remote: e4:42:f2:a3:94:2g:69:55:5a:21:87:b3:4d:bb:74:62. remote: Please contact your system administrator. remote: Add correct host key in /root/.ssh/known_hosts to get rid of this message. remote: Offending key in /root/.ssh/known_hosts:1 remote: RSA host key for 192.168.1.100 has changed and you have requested strict checking. remote: Host key verification failed. abort: no suitable response from remote hg!
2. After going “WTF?!” you realize that the IP address being used by hg pull has changed so of course there is an error. There are probably better way to actually add the correct host key as directed in the error but for me the easiest was to simply open /root/.ssh/known_hosts and delete the keys present. Don’t do this unless you know you can regenerate new keys with no problem (the ideal way would be to add the correct key as directed but I don’t know how to do that without Google and was in a hurry).
3. The next problem is that hg pull is pointing to the wrong location. To change this you can edit the default path in the hgrc file (located in the .hg directory inside your project) to point to the correct URL. Should look like:
[paths] default = ssh://username@192.168.1.100//location/of/your/project/
4. Now you should be able to do your pull!
Protip: Install a private/public key pair so you don’t have to log into ssh!
// generate the needed keys ssh-keygen -t rsa //that puts the key pair in your .ssh directory. //In my Ubuntu machine that is at /home/myname/.ssh/ //copy the id_rsa.pub key from that machine //to your remote machine's .ssh directory scp /home/myname/.ssh/id_rsa.pub username@192.168.1.100:/Users/myname/.ssh
Now move over to the remote machine:
//that file needs to go into a file called authorized_keys //(you may have to create this thus the touch command below) cd /Users/myname/.ssh/ touch authorized_keys cat id_rsa.pub >> authorized_keys //now protect that with some strict permissions sudo chmod 500 authorized_keys
Now you can make SSH connections (which pull is using) between these machines without having to supply a password each time.
Change an Ubuntu server’s timezone from the command line
This is pretty straight forward. Log in to the system and type:
dpkg-reconfigure tzdata
Follow along as it prompts you. Bam. Done.





