解决 CentOS 7 添加用户设置家目录出现 useradd cannot set SELinux context for home directory 问题

问题描述

直接贴下代码吧~

[root@localhost ~]# useradd -d /tmp/heheda4 heheda4
useradd: cannot set SELinux context for home directory /tmp/heheda4

解决方法

出现这种情况,主要和 SELinux 安全上下文的设定有关,只需要禁用它即可。

输入以下命令即可将它临时关闭。

setenforce 0

如果想永久关闭,需要编辑 /etc/sysconfig/selinux 配置文件

vi /etc/sysconfig/selinux

然后将 SELINUX=disabled 即可。

参考链接

http://www.voidcn.com/article/p-onjkjagh-bny.html

https://blog.csdn.net/yanjun821126/article/details/80828908

猜你喜欢

转载自www.cnblogs.com/walixz/p/10356071.html
今日推荐