Difference between revisions of "Osx-pwdrec"

From Bashlinux
Jump to: navigation, search
(Redirected page to OS X password recovery)
 
Line 1: Line 1:
 
#REDIRECT [[OS X password recovery]]
__NOTITLE__
 
__NOTOC__
 
= OS X password recovery =
 
In general terms, before any specific step to change the password, we need to first
 
# Boot on single-user mode
 
# Mount the system in read-write mode
 
# /sbin/fsck -fy
 
# mount -uw /
 
 
=== How to change a password on OS X 10.4 or older ===
 
Once the root filesystem is mounted r/w on single user mode, the procedure is as follows:
 
# sh /etc/rc
 
# passwd my_user
 
 
=== How to change a password on OS X 10.5 with no installation DVD ===
 
Once the root filesystem is mounted r/w on single user mode, the procedure is as follows:
 
# Launch the directory services
 
# Change/reset the password
 
# Reboot the system
 
 
In short, the list of commands are:
 
# launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
 
# dscl . -passwd /Users/<username> <password>
 
# reboot
 
 
=== How to change a password on OS X 10.8 with no installation DVD ===
 
Once the root filesystem is mounted r/w on single user mode, the procedure is as follows:
 
# Launch the directory services
 
# Change/reset the password
 
# Reboot the system
 
 
In short, the list of commands are:
 
# launchctl load launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
 
# dscl . -passwd /Users/<username> <password>
 
# reboot
 
 
=== How to change a password on XServe ===
 
Once the root filesystem is mounted r/w on single user mode, the procedure is as follows:
 
# nicl -raw /var/db/netinfo/local.nidb -create /users/$newuser _writers_passwd administrator
 
# passwd administrator
 
# reboot
 
 
=== How to create a new user with administrative privileges ===
 
First write down the gid which comes from admin group
 
# nicl -raw /var/db/netinfo/local.nidb -read /groups/admin
 
 
Lets say, the gid is '''''20''''', then from command line execute:
 
# nicl -raw /var/db/netinfo/local.nidb -create /users/my_user
 
# nicl -raw /var/db/netinfo/local.nidb -create /users/my_user uid my_user_id
 
# nicl -raw /var/db/netinfo/local.nidb -create /users/my_user realname "My User Real Name"
 
# nicl -raw /var/db/netinfo/local.nidb -create /users/my_user passwd "my_user_passwd"
 
# nicl -raw /var/db/netinfo/local.nidb -create /users/my_user gid 20
 
# nicl -raw /var/db/netinfo/local.nidb -create /users/my_user shell "/bin/bash"
 
# nicl -raw /var/db/netinfo/local.nidb -create /users/my_user home "/Users/my_user"
 
# nicl -raw /var/db/netinfo/local.nidb -create /users/my_user _writers_passwd my_user
 
# passwd my_user
 
# ditto /System/Library/UserTemplate/English.lproj /Users/my_user
 
# chown -R my_user:staff /Users/my_user
 
# nicl -raw /var/db/netinfo/local.nidb -read /users/my_user
 
# nicl -raw /var/db/netinfo/local.nidb -append /groups/wheel users my_user
 
# nicl -raw /var/db/netinfo/local.nidb -append /groups/admin users my_user
 

Latest revision as of 06:31, 6 June 2015