Mac OS X 10.5 從命令列刪除使用者帳戶

To delete a user from the command line in 10.5:

1. Boot into single user mode. Hold Command-s at startup.
開機進入單人模式. 在開啟電腦後馬上按 Command-s.

2. Check the filesystem:
# /sbin/fsck -fy

3. If no remaining errors, mount the filesystem:
如果沒有任何錯誤, 就掛載檔案系統
# /sbin/mount -uw /

4. Start up directory services:
# launchctl load /System/Library/LaunchDaemons/
Note that single user mode said to use, but that didn’t work — this did.

5. Find what groups the user belongs to:
# dscl . -list /groups GroupMembership | grep username
— repeat for each group except for the user’s own group.

6. Remove the group corresponding to the username:
# dscl . delete /groups/username
(this may not be necessary — you may get an error that the group doesn’t exist; you can ignore it and go on).

7. Remove the user account:
# dscl . delete /users/username

8. At this point, you may wish to remove or archive the user folder in /Users.
在此,你也許想移除在 /Users 內的使用者目錄.

9. You may wish to remove the .AppleSetupDone file in /var/db to cause the Setup Assistant to run when next booted.
你也許想移除在 /var/db 目錄內 .AppleSetupDone 檔案. 這樣下次開幾就會出現設定幫手(Setup Assistant).

10. All done? Type reboot to reboot the system or shutdown -h now to shut down the system.
都設定好了? 打 reboot 重新啟動電腦或是下 shutdown -h now 關機.

From : Delete users accounts from command line in 10.5


Comments are closed.