在使用su命令的时候报错”Failed to open temporary lock”

在Linux系统下使用su – user 命令时候,出现了报错“Failed to open temporary lock”该如何解决呢?
报错信息:

# su - user
 CASCU092E Failed to open temporary lock file (Diagnostic information: 2).
 CASCU092E Failed to open temporary lock file (Diagnostic information: 2).
 CASCU092E Failed to open temporary lock file (Diagnostic information: 2).
 CASCU092E Failed to open temporary lock file (Diagnostic information: 2).
 CASCU092E Failed to open temporary lock file (Diagnostic information: 2).

解决方案

我们使用strace命令追踪输出的过程中可以看到如下信息:

access("/tmp", W_OK|X_OK) = -1 EACCES (Permission denied) <0.000017>
access("/tmp", W_OK|X_OK) = -1 EACCES (Permission denied) <0.000015
open("/tmp/AIM57432", O_WRONLY|O_CREAT, 061001320) = -1 EACCES (Permission denied) <0.000023
write(2, "CASCU092E Failed to open temporary lock file (Diagnostic information: 2).\n", 74) = 74 <0.000022>

出现该问题是因为无法使用适当的权限写入/tmp,因此去查看其它正常的操作系统此目录具有Sticky Bit权限。因此该问题可以通过如下两种方式解决:

#chmod 1777 /tmp

或者

#chmod a+trwx /tmp

原创文章,作者:运维侠,如若转载,请注明出处:https://www.yunweixia.com/solutions/su-command-error-failed-to-open-temporary-lock-solution.html

(0)
运维侠的头像运维侠共建用户
上一篇 2025年7月21日 18:11
下一篇 2025年7月23日 18:11

相关推荐

发表回复

登录后才能评论