通过全新方式在 Apple 支持社区中投票!

你现在可以根据回复和用户使用技巧是否有用,来投出赞同票或反对票。进一步了解 <Apple 支持社区投票方式>的近期变更。

看上去一段时间内没有人回复。 要再次发起对话,只需提出一个新问题即可。

macos无法删除用户“ 您需要输入他们的密码”

macOS系统是:10.13.6

想要删除一个测试用户,提示要求输入密码,输入登录密码后,提示框只是抖动,不能删除。

试了试新建一个 新的用户,可以直接删除,并没有弹出需要输入密码的窗口。

请问这个现象是什么原因?

用户上传的文件

发布日期 2018年9月24日 下午8:18

回复
回复量: 15

2018年9月26日 上午9:23 回应 owee2008

运行命令看看:

w

也可能是在你的账户里有个进程打开了那个用户里的文件,尝试命令,比如用户名是test,则:

lsof |grep "/ Users/test"


下面列出本地用户,以及test用户的情况:


dscl . list /Users UniqueID | awk '$2>500'

dscl . read /Users/test


希望你说的是本地用户或者是移动用户。


下面列出你的和test帐户情况,如果不愿意可以不做:

id;groups;id test;groups test;


如果上面的输出自己可以分析也好,不行就贴上来。

2018年9月26日 下午6:06 回应 tonyfromcalgary

$ w

17:04 up 1 day, 5:23, 3 users, load averages: 1.72 1.56 1.57

USER TTY FROM LOGIN@ IDLE WHAT

myuser console - 11 29:21 -

myuser s000 - 16:57 5 -bash

myuser s001 - 16:58 - w



$ lsof |grep "/Users/test"

无输出



$ id;groups;id test;groups test;

uid=501(myuser) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),702(com.apple.sharepoint.group.2),701(com.apple.sharepoint.group.1),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh)

staff everyone localaccounts _appserverusr admin _appserveradm _lpadmin com.apple.sharepoint.group.2 com.apple.sharepoint.group.1 _appstore _lpoperator _developer _analyticsusers com.apple.access_ftp com.apple.access_screensharing com.apple.access_ssh

uid=502(test) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),702(com.apple.sharepoint.group.2),701(com.apple.sharepoint.group.1),100(_lpoperator)

staff everyone localaccounts com.apple.sharepoint.group.2 com.apple.sharepoint.group.1 _lpoperator



$ dscl . list /Users UniqueID | awk '$2>500'

test 502

myuser 501

2018年9月27日 上午8:40 回应 tonyfromcalgary

运行命令后,系统提示权限错误,我用的是管理员用户执行的:


$ sudo dscl . delete /Users/test;

Password:

<main> delete status: eDSPermissionError

<dscl_cmd> DS Error: -14120 (eDSPermissionError)



$ sudo rm -fr /Users/test

rm: /Users/test/Pictures: Operation not permitted

rm: /Users/test/Library/Application Support/CallHistoryTransactions: Operation not permitted

rm: /Users/test/Library/Application Support/com.apple.TCC: Operation not permitted

rm: /Users/test/Library/Application Support/CallHistoryDB: Operation not permitted

rm: /Users/test/Library/Application Support: Operation not permitted

rm: /Users/test/Library/IdentityServices: Operation not permitted

rm: /Users/test/Library/Preferences/com.apple.universalaccess.plist: Operation not permitted

rm: /Users/test/Library/Preferences: Operation not permitted

rm: /Users/test/Library/Messages: Operation not permitted

rm: /Users/test/Library/Mail: Operation not permitted

rm: /Users/test/Library/Safari: Operation not permitted

rm: /Users/test/Library/Suggestions: Operation not permitted

rm: /Users/test/Library/Containers: Operation not permitted

rm: /Users/test/Library/Metadata: Operation not permitted

rm: /Users/test/Library/Cookies: Operation not permitted

rm: /Users/test/Library/Caches/CloudKit/com.apple.Safari: Operation not permitted

rm: /Users/test/Library/Caches/CloudKit: Operation not permitted

rm: /Users/test/Library/Caches: Operation not permitted

rm: /Users/test/Library: Operation not permitted

rm: /Users/test: Operation not permitted

2018年9月27日 上午4:53 回应 owee2008

如果就是需要删除,可以尝试下面的命令行:

sudo dscl . delete /Users/test; sudo rm -fr /Users/test

简要说明:

虽然是看上去是一行,只是为了方便,其实是两行命令

第一个命令是从本地用户数据库中删除test用户

第二个命令是彻底删除test用户的用户文件夹,这个命令比较危险,不要随意改动。


注意!test用户数据无法恢复。

macos无法删除用户“ 您需要输入他们的密码”

欢迎来到 Apple 支持社区
Apple 客户在其产品方面互相帮助的论坛。使用你的 Apple ID 开始畅游其中吧!