OpenEuler系统普通用户切换root不成功问题

#解决OpenEuler操作系统创建普通用户切换root用户报错。

提示报错如图:
*
报错提示

解决方法如下:

方法 1. 路径:/etc/pam.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)
  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Jie_Chang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值