Wednesday, August 24, 2011

How to reset your Mac OS X password without an installer disc


Let’s say you totally forgot the password to log on to your Mac. Or maybe you purchased a used Mac from someone else and they’ve got it locked down. There are numerous ways to reset a password with no OS X discs.

This tutorial may ruffle some feathers, but it addresses a topic that a ton of people ask about all the time. Yes, it’s startling to think that anyone could theoretically walk up to your computer and gain access within minutes. Before you go thinking that Mac OS X has a severe vulnerability that makes it less secure than other operating systems, think again. Anyone with physical access to your machine (whether it is Windows, Linux, or Mac) can eventually find a way in if they know what they’re doing. There are ways of bypassing nearly any security measure when a hacker is literally sitting right in front of your system.

The information here has previously been made available from many different sources online and is presented with the intention of helping people with legitimate reasons for resetting their Mac OS X password. A few of the methods floating around the Mac community have been compiled here in one easy-to-reference place. System admins responsible for supporting entire organizations and users who bought used Macs are the folks most likely to benefit from this.


Reset 10.5 Leopard & 10.6 Snow Leopard password

  1. Power on or restart your Mac.
  2. At the chime (or grey screen if your chime is turned off), hold down Command+S on your keyboard to enter single-user mode.
  3. This step is optional, but it’s a good idea because it checks the consistency of the hard disk before moving on. At the prompt, type fsck -fy and press Enter/Return. Wait for the checks to complete before going to the next step.
  4. Type mount -uw / and press Enter.
  5. Type launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist and press Enter.
  6. Type ls /Users and press Enter. This lists all of the usernames on the computer – helpful if you don’t know or remember what these are.
  7. Type dscl . -passwd /Users/username password and replace “username” with one of the users displayed in the previous step. Replace “password” with a new password of your choice. Press Enter.
  8. Type reboot and press Enter.



Reset 10.5 Leopard & 10.6 Snow Leopard password

  1. Power on or restart your Mac.
  2. At the chime (or grey screen if your chime is turned off), hold down Command+S on your keyboard to enter single-user mode.
  3. This step is optional, but it’s a good idea because it checks the consistency of the hard disk before moving on. At the prompt, type fsck -fy and press Enter/Return. Wait for the checks to complete before going to the next step.
  4. Type mount -uw / and press Enter.
  5. Type launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist and press Enter.
  6. Type ls /Users and press Enter. This lists all of the usernames on the computer – helpful if you don’t know or remember what these are.
  7. Type dscl . -passwd /Users/username password and replace “username” with one of the users displayed in the previous step. Replace “password” with a new password of your choice. Press Enter.
  8. Type reboot and press Enter.

Reset 10.4 Tiger password

  1. Power on or restart your Mac.
  2. At the chime (or grey screen if your chime is turned off), hold down Command+S on your keyboard to enter single-user mode.
  3. Type sh /etc/rc and press Enter/Return.
  4. Type passwd username and replace “username” with the short name of the user account for which you’d like to reset the password.
  5. Type your desired password and press Enter. It won’t show itself on the screen, so be careful what you type. You will most likely have to enter it again to confirm.
  6. Type reboot and press Enter.

This is my favorite :D

Tricking your Mac into creating a new user account

  1. Power on or restart your Mac (should work for any Mac OS X system).
  2. At the chime (or grey screen if your chime is turned off), hold down Command+S on your keyboard to enter single-user mode.
  3. This step is optional, but it’s a good idea because it checks the consistency of the hard disk before moving on. At the prompt, type fsck -fy and press Enter/Return. Wait for the checks to complete before going to the next step.
  4. Type mount -uw / and press Enter.
  5. Type rm /var/db/.AppleSetupDone and press Enter.
  6. Type shutdown -h now and press Enter.

The third method of resetting your Mac’s password requires some additional explanation. Rather than simply changing the password like the previous two methods do, this one fools the operating system into believing it has never been started before. This means when you restart the machine, it will take you through the entire setup & registration process all over again. Do not worry, all of your pre-existing data is still available. Just continue with this process and do not choose the option to transfer or migrate information to the Mac.

Once you’re done, log in with your new admin account and go to System Preferences > Accounts. You may have to click on the lock icon in the lower-left corner before making changes here. You should see your original user account(s) in the left column. Try clicking on one of them to convert it to a standard user account (uncheck “Allow user to administer this computer”) and change the password. You should be able to successfully log in to that account now and access all of your files and programs. If you want, you can log back in with your new admin account and re-check the “Allow user to administer this computer” option in System Preferences to grant admin privileges to the original user again.
That should cover it! As always, remember messing with single-user mode and Terminal is risky and may lead to trouble if you make mistakes. Considering you’re already locked out of the computer, though, you’ll probably be willing to take your chances at this point.

One last thing… if you have a Keychain Access password, you will probably need to reset that as well. You can do this by selecting “login” under Keychains on the left and choosing Delete from the Edit menu. You’ll lose everything in the Keychain, but you’ll now be able to start fresh and add new ones.



Source: http://www.macyourself.com/2009/08/03/how-to-reset-your-mac-os-x-password-without-an-installer-disc/

Monday, August 22, 2011

jboss.bind.address and JBoss no accepting connections

When I was trying to do some connectivity testing with one of my colleagues I faced this issue.
What I was trying to do was really simple, on my local Server I have deployed a Web Service and my colleague has the client, the happy path is just share my IP, port and URI, right?

But there is 1 little difference compared with my previous projects: I'm using Mac OS X and my colleague Windows XP. Not a big deal, actually, this is an advantage, because I have a faster machine :P

What's the problem? I think None, BUT...

How can I get my IP address on Mac?
jcruz@Quetzalcoatl[~]$ ifconfig

That was easy!

What about JBoss? Because when I start my server, I can't access it through the IP listed on the previous command!

The solution is really simple:
jboss.bind.address is configured using the "-b" option to the JBoss startup script (run.sh or run.bat in the bin directory).
For example, (on my case sh ./run/bin/run.sh -c myServer -b 0.0.0.0) run -b 0.0.0.0 enables jboss to listen for connections on all IP addresses of the machine (if multi-homed).

Thursday, August 18, 2011

Switch from PC to Mac


I found this great article about someone like me who just switched from PC (Windows) to Mac, I hope you enjoy it as much as I did

The Story

Have you ever tried to resist brainwashing?
Before I get into why I switched, there’s some background you need to know. A year or three ago, you’d be hard pressed to find a more dedicated self-ordained Windows evangelist. I even wrote a lengthly piece about Mac vs. Windows and how I thought Windows had a stronger position (thankfully, that was only published on Google Docs, so no one can ever find it, as it was obviously biased). Over time, a few things happened. First, a couple of my cousins—shoutout to Britt and Matt—came in possession of a couple of MacBooks. Since I see them rather regularly, there was no shortage of opportunities for them to tout their new tools.
Have you ever tried to resist brainwashing?
The next big shift was dabbling in several dynamic programming languages, like Python and Ruby. It seems that it’s always easier to start up with these languages if you’re using a Unix-based OS. While it’s definitely not impossible on Windows, they don’t seem to integrate with the OS in the same way they do with Unix flavours.
Of course, there were better reasons than peer pressure (more on that in a minute). However, when my Windows 7 Release Candidate ran out, I gave myself an ultimatum: either buy Window 7 and secondary monitor, or get a used Mac. After a week or so of deliberation, I found myself in a miniature Starbucks in downtown Toronto, buying a 20-inch iMac off a third-year psychology student.

The Reasons Why I Switched

So what came out of those few weeks of deliberation? Here’s why I switched:

Unix

Probably the biggest motivation to switch was the fact that Mac OS X is built on Unix. Being a real geek, I’m reasonably comfortable with the terminal; if you’re the same, you probably know that a Unix shell offers a lot more power than the Windows command line. Yes, I’ve tried Cygwin, but it’s not quite the same (and I never actually got it to work on Window 7 RC). Then there are Ruby and Python, so much more at home on Unix. And of course, there are so many other low-level benefits to running Unix.
So why didn’t I just switch to Ubuntu? Well, Ubuntu is really nice, especially the latest release, but it really just didn’t work for me, not for a full time gig.

Hardware

Hardware
This one’s a no-brainer: Apple just makes their hardware better than most of the competition. I know that beauty is in the eye of the beholder, and that all that’s beautiful is not aluminium. However, I like Apple’s minimalistic stance. And of course, it’s what insides that matters most, and Apple does an excellent job there, too. There’s a catch to Apple hardware, though, and we’ll talk about that later.

Software

Software
The final reason was simply this: there’s a lot of great software for Macs that doesn’t have a good Windows counterpart. There are two cases I ran into. First, there’s nothing on Windows that does as well, or at all, what I’ve found in a Mac app. Example: I use Simplenote a lot on my iPod Touch; there are four or five Mac apps that sync with Simplenote; before I switched, I had to use a perl script to do this on Windows. (Now,Uri Fridman has made Notes, which is based on Notational Velocity, and will soon support Simplenote sycing! Check out his site for other great nuggets; Codex is another of my favourites). Then, there are programs that do the right things, but aren’t as aesthetically pleasing and user-friendly as the Mac apps. For example, I use Evernote a lot; their Windows client does as much (and a bit more, I think) as their Mac client, but it’s just not as pretty.
However, there’s a catch on the software, too.

The Good What I’m Liking

So now that I’ve switched, here are my favourite things about the Mac; some may seem rather insignificant, but when your working full-speed and don’t want to break that flow, little things matter a lot.

The Terminal

The Terminal
I’ve already pointed out that the Terminal was part of my first reason for switching; it’s every bit as glorious as I expected it to be, and has motivated me to use it more that I have on Windows. Anyone who has used the Command Line on Windows and Terminal on Mac will know exactly how much better a Unix shell is.

Languages Preinstalled

I was surprised and delighted to find that my Mac came with Ruby, Python, Perl, and even Java (which I need for university) already installed.

Mounted Drives on the Desktop

Drives
This is a feature of Unix that I’ve always loved and could never find a way to duplicate on Windows. Not huge, I know; but, huge.

Quicklook

Quicklook
Another tiny feature that saves me a second-and-a-half, dozens and dozens of times a day. I’m working mainly with text files, but for everything from code to Word docs, I’m just a tap on the spacebar away from inspecting the contents of that file. Only gripe: I can’t copy from the quicklook panel.

Time Machine

Time Machine
It’s kind of a hassle to do backup and restore on Windows. With Time Machine, it’s easy and fun. I do wish I had a bit more control over what it backs up and how often (without the numerous hacks), but for daily backup and revisions, it works flawlessly and easily.

Installing Apps

Installing Apps
Installing apps on Mac is much different from installing them on Windows. They both use extremely different methods; and overall, I think the Mac does it much more smoothly.

The Bad What I’m not Liking

But all’s not perfect in any OS; here’s what’s bothering me about the Mac:

The Trash

The Trash
I really don’t get the philosophy of the trash on the Mac; I know you’re not supposed to use the Trash as a holding place for the files you’re not sure about, but why can’t I delete individual files? Why? Here’s a scenario I’ve had: I wanted to get rid of several gigabytes of files, in multiple folders that I’d just zipped into an archive; so, I moved them all to the trash, and then opened the trash to get rid of them permanently. First, I wanted to sort the files by the date/time they were moved to the trash, but that’s not a feature Jobs would ever need, and so I can’t do it. That’s when I found I couldn’t delete individual items; just all or nothing. Mighty inconvenient, if you ask me. I should have used the Terminal to terminate them.

Too Few USB ports

My 20-inch iMac has fewer USB ports than my Dell Laptop did; it only has 3; my Inspiron 1520 had 4; how do you explain that? Then, the old USB extender I was using on Windows doesn’t appear to work on the Mac; not Mac’s fault necessarily, but certainly less than ideal.

“Enter” doesn’t open the file/folder

This one is just a matter of muscle memory, but it’s rather annoying. On Windows, hitting enter opens a file or folder; on Mac, the enter key renames the item in question. To open it, I’ve got to use two keys: cmd + o. On the same note, it now takes two keystokes to send files to that crooked Trash: cmd + delete instead of just delete.

Home and End Keys

This has to be the most frustrating part about the Mac. On Windows, the home key places your cursor at the front of the current line; the end key places it at the end. However, on a Mac the respective commands are cmd + left-arrow and cmd + right-arrow. This has been pretty hard to get used to; and, since I’m in text editors a lot of the time, hitting home and end (which, by the way, bring you to the top or bottom of the linebut does not move your cursor) has been a dizzying experience.

Keyboard shortcuts

Keyboard
I know I’ve already talked about two specific keyboard shortcuts that bother me, but keyboard shortcuts in general have been hard. It’s mainly because the cmd key takes the place of the ctrl key in the shortcuts, but it takes the place of the alt key on the keyboard. So if you’ve used Windows for a long time, caveat emptor.

The Other What I’d also like to mention

I’ve shown you what’s good and what’s bad, but there are a few things I have to mention that don’t really fit into either of those categories. Welcome to miscellaneous.

Closing Windows / Programs

One of the biggest differences between Windows is Mac what happens when you close a window; on Windows (and with a name like that, they should know how to deal with it) the program closes; on Mac, the window closes but the program continues to run. I think the idea here is that it will be quicker to open just a window instead of the whole app next time you need to open it. This is nice for the most part, but I think some apps of a certain nature should really and truly exit when you close their windows. And some do, like System Preferences. I really wish Preview did this. This is one of those fundamental feature of Mac OS X that really takes a paradigm shift to properly grok.

Knowing what’s going on

I’m familiar with Windows, to say the least. I had my A+ certification, which deals mainly with Windows, so I have a pretty good idea of what’s going on under the covers when working on Windows PC. I really miss this intimate knowledge of the system when working with a Mac. I know it’s not an unsolvable problem, but it’s been pretty different to not have that background knowledge. For example, I was recently surprised to find that Time Machine has maxed out my external hard drive; it turned out that iTunes copies all the imported media into the iTunes folder, so I had a two copies of the entire library being backed up. Like Sir Francis Bacon said, “Knowledge [about how the system works] is power.”

The software catch

There’s a ton of great software for Mac; however, it seems that the moving from Windows to Mac also requires a move from free software to quality software. Now, I know there’s quality, paid-for software for Windows, and free software for Macs. However, for every quality, paid-for app on Windows, there are five or six free ones that will do the same job decently. On Mac, the same isn’t quite so true. It seems that Mac developers just put a lot of thought and sweat into their products.

The hardware catch

Like I’ve said, Apple makes great hardware. However, one thing I know I’m going to miss is the ability to upgrade it. Apple does make it easy enough to add RAM. But when I’m ready to upgrade my hard drive, well, it will be scary at best. But I’d gladly sacrifice the single-piece back-side of my iMac for an easy-to-access hard drive slot.

Switching?

Throughout this article, I’ve talked about switching to a Mac. And yes, I’ve switched to a Mac as my main workhorse. But my trusty old Dell hasn’t gone anywhere. It’s still in good use, and syncing services likeEvenote and Dropbox (referral link) more than ever.

The Resources What I’ve found Helpful

Switching operating systems is a pretty big change; here are the resources that have been the biggest help to me while doing so; don’t forget to let me know about other great sources in the comments!

A Very Important Conclusion

Switching to Mac has in no way made me an Apple fanboy or a Microsoft hater. I couldn’t say it better than this:
“Mac vs PC debates make me want to throw up. Does your OS of choice work for you? Great, problem solved!”
Drew Douglass


Source: http://net.tutsplus.com/