#解决OpenEuler操作系统创建普通用户切换root用户报错。
提示报错如图;
*
解决方法如下;
方法 1. 路径;/etc/pad.d/su 通过注释配置文件第21行使得能够进行切换
注释;PAM;Pluggable Authentication Modules;负责系统中很多应用程序的登录认证;安全设置问题
1 #######################################################################################
2 #
3 # Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved.
4 # security-tool licensed under the Mulan PSL v2.
5 # You can use this software according to the terms and conditions of the Mulan PSL v2.
6 # You may obtain a copy of Mulan PSL v2 at:
7 # http://license.coscl.org.cn/MulanPSL
8 # THIS SOFTWARE IS PROVIDED ON AN ;AS IS; BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
9 # IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
10 # PURPOSE.
11 # See the Mulan PSL v2 for more details.
12 # Description: Configuration File for PAMified Services
13 #
14 #######################################################################################
15
16 #%PAM-1.0
17 auth sufficient pam_rootok.so
18 # Uncomment the following line to implicitly trust users in the ;wheel; group.
19 #auth sufficient pam_wheel.so trust use_uid
20 # Uncomment the following line to require a user to be in the ;wheel; group.
21 #auth required pam_wheel.so use_uid
22 auth substack system-auth
23 auth include postlogin
24 account sufficient pam_succeed_if.so uid = 0 use_uid quiet
25 account include system-auth
26 password include system-auth
27 session include system-auth
28 session include postlogin
29 session optional pam_xauth.so
方法 2. 对创建用户进行附加mygroup权限
usermod -G wheel username
#改变用户分组;将用户添加进wheel分组
#usermod [-G] [GroupName] [UserName]
#语法
# id username
id user1
#执行结果如下
uid=1008(user1) gid=1008(user1) groups=1008(user1),1012(mygroup)