疑难杂症——bash: /dev/null: Permission denied

前端之家收集整理的这篇文章主要介绍了疑难杂症——bash: /dev/null: Permission denied前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

描述

在使用 Devstack 的时候需要时常切换用户su stack,此时会触发错误

root@mickeyfan-dev:~# su stack
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
bash: /dev/null: Permission denied

一般而言,Permission denied 问题可以通过 reset 权限 chmod 666 /dev/null解决,但在 Ubuntu 中,系统会自动将设备的权限还原为 420 crw--w---- 1 root tty 1,3 Aug 26 11:46 /dev/null。所以常用的方法并不能解决该问题。

解决方

-bash: /dev/null: Permission denied

此时,你需要删除 /dev/null 文件,并重新创建它:

rm -f /dev/null; mknod -m 666 /dev/null c 1 3
原文链接:https://www.f2er.com/bash/391164.html

猜你在找的Bash相关文章