Difference between revisions of "Osx-pwdrec"
From Bashlinux
Line 1: | Line 1: | ||
+ | __NOTITLE__ |
||
__NOTOC__ |
__NOTOC__ |
||
+ | |||
= OS X password recovery = |
= OS X password recovery = |
||
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 |
||
# Mount the system in read-write mode |
# Mount the system in read-write mode |
||
− | <pre><nowiki> |
||
# /sbin/fsck -fy |
# /sbin/fsck -fy |
||
# mount -uw / |
# mount -uw / |
||
− | </nowiki></pre> |
||
− | == How to change a password on OS X 10.4 or older == |
+ | === 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: |
Once the root filesystem is mounted r/w on single user mode, the procedure is as follows: |
||
− | <pre><nowiki> |
||
# sh /etc/rc |
# sh /etc/rc |
||
# passwd my_user |
# passwd my_user |
||
− | </nowiki></pre> |
||
− | == How to change a password on OS X 10.5 with no installation DVD == |
+ | === 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: |
Once the root filesystem is mounted r/w on single user mode, the procedure is as follows: |
||
# Launch the directory services |
# Launch the directory services |
||
# Change/reset the password |
# Change/reset the password |
||
# Reboot the system |
# Reboot the system |
||
+ | |||
− | + | In short, the list of commands are: |
|
− | <pre><nowiki> |
||
# launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist |
# launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist |
||
# dscl . -passwd /Users/<username> <password> |
# dscl . -passwd /Users/<username> <password> |
||
# reboot |
# reboot |
||
− | </nowiki></pre> |
||
− | == How to change a password on OS X 10.8 with no installation DVD == |
+ | === 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: |
Once the root filesystem is mounted r/w on single user mode, the procedure is as follows: |
||
# Launch the directory services |
# Launch the directory services |
||
# Change/reset the password |
# Change/reset the password |
||
# Reboot the system |
# Reboot the system |
||
+ | |||
− | + | In short, the list of commands are: |
|
− | <pre><nowiki> |
||
# launchctl load launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist |
# launchctl load launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist |
||
# dscl . -passwd /Users/<username> <password> |
# dscl . -passwd /Users/<username> <password> |
||
# reboot |
# reboot |
||
− | </nowiki></pre> |
||
− | == How to change a password on XServe == |
+ | === How to change a password on XServe === |
Once the root filesystem is mounted r/w on single user mode, the procedure is as follows: |
Once the root filesystem is mounted r/w on single user mode, the procedure is as follows: |
||
− | <pre><nowiki> |
||
# nicl -raw /var/db/netinfo/local.nidb -create /users/$newuser _writers_passwd administrator |
# nicl -raw /var/db/netinfo/local.nidb -create /users/$newuser _writers_passwd administrator |
||
# passwd administrator |
# passwd administrator |
||
# reboot |
# reboot |
||
− | </nowiki></pre> |
||
− | == How to create a new user with administrative privileges == |
+ | === How to create a new user with administrative privileges === |
First write down the gid which comes from admin group |
First write down the gid which comes from admin group |
||
− | <pre><nowiki> |
||
# nicl -raw /var/db/netinfo/local.nidb -read /groups/admin |
# nicl -raw /var/db/netinfo/local.nidb -read /groups/admin |
||
− | </nowiki></pre> |
||
Lets say, the gid is '''''20''''', then from command line execute: |
Lets say, the gid is '''''20''''', then from command line execute: |
||
− | <pre><nowiki> |
||
# nicl -raw /var/db/netinfo/local.nidb -create /users/my_user |
# 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 uid my_user_id |
||
Line 70: | Line 61: | ||
# nicl -raw /var/db/netinfo/local.nidb -append /groups/wheel 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 |
# nicl -raw /var/db/netinfo/local.nidb -append /groups/admin users my_user |
||
− | </nowiki></pre> |
Revision as of 01:19, 6 June 2015
__NOTITLE__
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