CentOS创建账号无法登陆
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS创建账号无法登陆相关的知识,希望对你有一定的参考价值。
CentOS测试,创建jack账号,删除时只使用userdel jack,没加参数
账号删除成功,但是对应的home文件夹/home/jack并没有删除。
重新创建账号,设置密码,尝试登陆,提示以下错误:
Last failed login: Wed Mar 8 14:05:39 CST 2017 from 10.15.105.20 on ssh:notty There were 8 failed login attempts since the last successful login. Could not chdir to home directory /home/jack: Permission denied -bash: /home/jack/.bash_profile: Permission denied
查看home目录下的文件夹属主,发现属主变为ID
[[email protected] ~]# ll /home total 0 drwx------. 2 1000 1001 59 Mar 6 19:34 jack
使用chown更改文件夹属主
[[email protected] ~]# chown jack /home/jack
再次登陆,成功。
另外,需要禁用某账号,可添加/etc/nologin文件,查看已连接账号,使用pkill结束进程,即可禁用该账号登录。如需重新激活,可删除/etc/nologin,适用于管理账号。
[[email protected] ~]# touch /etc/nologin [[email protected] ~]# w 17:00:53 up 5 days, 21:27, 3 users, load average: 0.00, 0.01, 0.05 USER TTY FROM [email protected] IDLE JCPU PCPU WHAT root tty1 Thu19 44:42m 0.00s 0.00s -bash root pts/0 10.15.105.20 09:39 5.00s 0.02s 0.00s w jack pts/1 10.15.105.20 16:28 28:13 0.00s 0.00s bash [[email protected] ~]# pkill -kill -t pts/1 [[email protected] ~]# rm -rf /etc/nologin 知识点: chown root /u Change the owner of /u to "root". chown root:staff /u Likewise, but also change its group to "staff". chown -hR root /u Change the owner of /u and subfiles to "root".
本文出自 “扬帆起航” 博客,请务必保留此出处http://mystery888.blog.51cto.com/9560453/1904422
以上是关于CentOS创建账号无法登陆的主要内容,如果未能解决你的问题,请参考以下文章