标签:permission denied;chown;pkill
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
[root@localhost ~]# ll /home total 0 drwx------. 2 1000 1001 59 Mar 6 19:34 jack
使用chown更改文件夹属主
[root@localhost ~]# chown jack /home/jack
再次登陆,成功。
另外,需要禁用某账号,可添加/etc/nologin文件,查看已连接账号,使用pkill结束进程,即可禁用该账号登录。如需重新激活,可删除/etc/nologin,适用于管理账号。
[root@localhost ~]# touch /etc/nologin [root@localhost ~]# w 17:00:53 up 5 days, 21:27, 3 users, load average: 0.00, 0.01, 0.05 USER TTY FROM LOGIN@ 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 [root@localhost ~]# pkill -kill -t pts/1 [root@localhost ~]# 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
标签:permission denied;chown;pkill
原文地址:http://mystery888.blog.51cto.com/9560453/1904422