当前位置: 代码迷 >> 综合 >> How to solve the cannot open session prompt when using the su command in Centos 7
  详细解决方案

How to solve the cannot open session prompt when using the su command in Centos 7

热度:78   发布时间:2023-12-15 00:32:17.0

How to solve the cannot open session prompt when using the su command in Centos 7

  • Problem
  • Solve

Problem

刚才用文章CentOS创建sudo用户创建了一个账号lwk,然后用su - lwk命令的时候报错了。

-bash-4.2$ su - lwk
Password: 
Last failed login: Thu Jun 28 15:39:52 CST 2018 from 36.24.223.44 on ssh:notty
There was 1 failed login attempt since the last successful login.
su: cannot open session: Permission denied
-bash-4.2$

Solve

经多方查找,终于解决了访问题。解决思路如下:
编辑文件/etc/security/limits.conf,在文件末尾追加如下内容:

lwk soft nofile 65535
lwk hard nofile 65535

其中,lwk是打算用su - lwk命令进行切换用户的用户名。

参考文献:

  • Centos Docker container su: cannot open session: Permission denied
  • linux用户登陆显示:could not open session
  • Unable to su into an account: could not open session
  • Running “su” Returns the Error “could not open session”
  相关解决方案