Category Archives: Interesting Tech Crap

Single User Mode Password Reset Mountain Lion Edition

My previous article on resetting a Mac OS X password using single user mode is by far the most popular post i’ve ever made.  That is to say, people actually go there intentionally.  Unfortunately, that post was made in 2008 and is just a little out of date.  For example, it talks about 10.4.  So, in an effort to induce hapless victims to visit once again, i’m doing an updated post for Lion (10.7) and now Mountain Lion (10.8).

In my previous post I included a last ditch effort involving wiping out the user database completely and allowing the Mac OS X setup assistant to run again and create a user.  I’m going to skip that.  If you wish, my previous post is still available and, to my knowledge, you can still reset the user database that way.  This post will be about resetting an existing user’s password.

Read more »

Regex file rename.

Short post today, trying to post more often.

Ever had a folder full of files?  Universally, the answer to that is yes.  But, have you ever wanted to mass rename the files according to a pattern?  I had such a need today.  I had a poorly thought out backup script for my sql files.  I had named them all by date in the pattern mm.dd.yy.tar.gz.  That works just fine for a year but after that, they don’t sort well.  You end up with something like below.

12.27.09.tar.gz
12.27.10.tar.gz
12.27.11.tar.gz
12.28.09.tar.gz
12.28.10.tar.gz
12.28.11.tar.gz

See the problem?  Its not sorted properly when you get a folder listing.  Makes it difficult to determine which backups you actually have.  So, I wrote a little regex to rename them all.  I matched the first four digits ($1) the last set of digits ($2) and the rest of the file ($3).  Then I rename it in the form 20$2.$1.$3.  This has the effect of placing the year at the beginning of the file like i should’ve done to begin with.

rename -v 's/(\d\d\.\d\d)\.(\d\d)\.(.+)$/20$2\.$1\.$3/' *.gz

That one little command instantly renamed 731 files saving me an enormous amount of time and effort.  Knowing regular expressions has been a very useful skill.  I strongly encourage anyone interested to visit regular-expressions.info.

References

SSH Password Logging

So, i’m alive.  I know I don’t post as often as I should.  And I know you probably feel left out, alone, bereft.  Fear not, I am back.

Logging Attempted Passwords With SSH

Anyway, remember that post I made of ssh attempts way back when?  Well, I got bored.  I decided it wasn’t enough to see the usernames attempted, I needed to see the passwords attempted as well.  My first thought was to use one of the honeypot ssh servers that exist and simply run the real ssh on another port.  I didn’t like that approach.  For one thing,  I don’t want the attacker to actually make it in, not even to a fake environment.

Read more »

Remote Desktop over ssh tunnel

This is a quick little post to show off some of the capabilities of an ssh tunnel. So, the back story. Earlier today, i was having a problem. There is a server on lcsd2.org that i needed gui (Apple Remote Desktop) access to. In the past, there is an ipsec based vpn i could use that was as simple as a single mouse click. Unfortunately, UW has decided, for whatever reason, that outbound ipsec tunnels shouldn’t be allowed. I can’t connect. However, i do have ssh access to a server on the inside of the network, and thats how this works. Read more »

Page 1 of 3123