Showing posts with label Single user mode. Show all posts
Showing posts with label Single user mode. Show all posts

Thursday, December 9, 2010

Reset a user's password in single user mode

We needed to reset the password on a Leopard system, but we didn't have the OS X install DVD available. 
  1. Boot into single user mode (press Command-S at power on)
  2. Type fsck -fy
  3. Type mount -uw /
  4. Type launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
  5. Type dscl . -passwd /Users/username password, replacing username with the targeted user and password with the desired password.
  6. Reboot
This allows you to reset the password in single user mode without booting from the install media. 

Completely disable single user mode

A very simply way to disable single-user mode is to edit /etc/rc.boot (as root or with sudo) and in the section that prints "file system mounted read-only", simply add a line that says reboot Now, anytime the computer is booted in single-user mode, it simply reboots itself. 
This is totally non-bypassable because Apple disables any usable keys in the begining of the rc files.