Difference between revisions of "Osx-pwdrec"
From Bashlinux
(talk) |
|||
Line 1: | Line 1: | ||
__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 |
|
− | As an older unix the procedure is: |
||
# Boot on single-user mode |
# Boot on single-user mode |
||
− | # |
+ | # Mount the system in read-write mode |
⚫ | |||
− | |||
⚫ | |||
# /sbin/fsck -fy |
# /sbin/fsck -fy |
||
# mount -uw / |
# mount -uw / |
||
+ | </nowiki></pre> |
||
+ | |||
⚫ | |||
+ | Once the root filesystem is mounted r/w on single user mode, the procedure is as follows: |
||
⚫ | |||
# sh /etc/rc |
# sh /etc/rc |
||
# passwd my_user |
# passwd my_user |
||
</nowiki></pre> |
</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: |
||
− | # Mount the system in read-write mode |
||
# 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: |
In short, the list of commands are: |
||
⚫ | |||
− | |||
⚫ | |||
− | # /sbin/fsck -y |
||
− | # /sbin/mount -uw |
||
# 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> |
||
Line 29: | Line 28: | ||
</nowiki></pre> |
</nowiki></pre> |
||
+ | == 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 |
||
− | # Boot on single-user mode: |
||
⚫ | |||
− | # Mount partition |
||
⚫ | |||
# Reboot the system |
# Reboot the system |
||
In short, the list of commands are: |
In short, the list of commands are: |
||
+ | <pre><nowiki> |
||
− | |||
+ | # launchctl load launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist |
||
+ | # dscl . -passwd /Users/<username> <password> |
||
+ | # reboot |
||
+ | </nowiki></pre> |
||
+ | |||
+ | == How to change a password on XServe == |
||
+ | Once the root filesystem is mounted r/w on single user mode, the procedure is as follows: |
||
<pre><nowiki> |
<pre><nowiki> |
||
− | # fsck |
||
− | # mount -uw / |
||
# 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> |
</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> |
<pre><nowiki> |
||
# nicl -raw /var/db/netinfo/local.nidb -read /groups/admin |
# nicl -raw /var/db/netinfo/local.nidb -read /groups/admin |
||
Line 54: | Line 55: | ||
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 |
Revision as of 23:01, 7 March 2013
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