Difference between revisions of "OS X password recovery"
From Bashlinux
(Created page with "__NOTOC__ 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 -...") |
|||
Line 1: | Line 1: | ||
__NOTOC__ |
__NOTOC__ |
||
+ | <!-- ##master-page:Mac_OS_X --> |
||
In general terms, before any specific step to change the password, we need to first |
In general terms, before any specific step to change the password, we need to first |
||
# Boot on single-user mode |
# Boot on single-user mode |
Latest revision as of 06:44, 6 June 2015
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