CentOS测试,创建jack账号,删除时只使用userdel jack,没加参数
账号删除成功,但是对应的home文件夹/home/jack并没有删除。
LastFailedlogin:WedMar814:05:39CST2017from10.15.105.20onssh:notty Therewere8Failedloginattemptssincethelastsuccessfullogin. Couldnotchdirtohomedirectory/home/jack:Permissiondenied -bash:/home/jack/.bash_profile:Permissiondenied
查看home目录下的文件夹属主,发现属主变为ID
[root@localhost~]#ll/home total0 drwx------.21000100159Mar619:34jack
使用chown更改文件夹属主
[root@localhost~]#chownjack/home/jack
再次登陆,成功。
另外,需要禁用某账号,可添加/etc/nologin文件,查看已连接账号,使用pkill结束进程,即可禁用该账号登录。如需重新激活,可删除/etc/nologin,适用于管理账号。
[root@localhost~]#touch/etc/nologin [root@localhost~]#w 17:00:53up5days,21:27,3users,loadaverage:0.00,0.01,0.05 USERTTYFROMLOGIN@IDLEJcpuPcpuWHAT roottty1Thu1944:42m0.00s0.00s-bash rootpts/010.15.105.2009:395.00s0.02s0.00sw jackpts/110.15.105.2016:2828:130.00s0.00sbash [root@localhost~]#pkill-kill-tpts/1 [root@localhost~]#rm-rf/etc/nologin 知识点: chownroot/u Changetheownerof/uto"root". chownroot:staff/u Likewise,butalsochangeitsgroupto"staff". chown-hRroot/u Changetheownerof/uandsubfilesto"root".原文链接:https://www.f2er.com/centos/378467.html