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/com.apple.DirectoryServices.plist
Note that single user mode said to use com.apple.DirectoryServicesLocal.plist, 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.