Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Monday, July 13, 2009

Passwordless SSH

I've done this a million times already -- but nevertheless I need to look at a reference every time I do it.

The idea is to be able to ssh from user1@machine1 to user2@machine2, without being asked for a password.

To do it, run the following commands (all of them as user1@machine1):
  1. Create a ssa key on machine1:
    ssh-keygen -t rsa
  2. Copy the public key over to machine2:
    cat ~/.ssh/id_rsa.pub | ssh user2@machine2 "cat - >> ~/.ssh/authorized_keys"
    (you may need to accept the server's fingerprint (say Yes), and will need to type your password this time).
It's done. Now just ssh to machine2 and it won't ask for a password.

Note: This also works for doing ssh to the same machine, under a different user. Just make sure user1's id_rsa.pub key is added to user2's ~/.ssh/authorized_keys file.

Note2: SSH is very strict with respect to permissions. The .ssh dir MUST have "700" permissions mask, and authorized_keys must be a 600. Anything different (and if you create authorized_keys, it will likely be created with a different access mask) will make this authentication method fail, and move on to the next one (ie. ask for a password).

Wednesday, May 20, 2009

Recovering a lost Windows XP password

I have a computer that run linux 99% of the time... But I also boot windows XP once in a while (every year or so) to do something specific like trying out some 3d game. Don't ask why, but I tend to forget that password. It happened twice already, so I am documenting the workaround for the next time it happens!

Very quickly, here are the steps:
  1. Download ophcrack: http://ophcrack.sourceforge.net/
  2. Download also some rainbow tables. I have used xp_free_small (380mb). The smallest but not fastest or strongest table -- enough for my purposes.
  3. ./configure && make
  4. (I skip the make install -- I am going to use the binary that is left in src/)
  5. I am running windows in the same computer, so I will just mount the windows partition: sudo mount /dev/sda1 /mnt/xp
  6. Click Load -> Encripted SAM. Choose /mnt/xp/WINDOWS/system32/config . This will load all your password hashes directly from that Windows.
  7. Select accounts you don't want to crack (e.g. you already know the password), to save cpu time, and click Delete on them.
  8. Tables -> Install , add the one(s) that you downloaded.
  9. Click Crack!
That's it. If you are lucky, just as I am, you will have your password shown in screen, in the clear, for anyone looking on your shoulders.

ophcrack has a lot of useful options, I strongly recommend reading at least the help (big Help button on top of main window).

happy cracking!