-bash: /dev/null: Permission denied

今天在Centos7上运行如下命令

######添加hdfs用户#####
useradd hdfs

######切换至hdfs用户#####
su - hdfs

报如下错误

-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

查看/dev/null的权限如下

ll /dev/null
-rwxr-xr-x  1 root root           9 Jul 25 17:07 null

而其他正常的权限如下

crw-rw-rw-   1 root   wheel         3,   2 Jul 25 14:08 null

解决步骤如下:

rm -f /dev/null; mknod -m 666 /dev/null c 1 3

说明:重新reboot和recreate一下/dev/null即可。

更多解决方案尝试可参看:

https://superuser.com/questions/814593/cannot-access-dev-null-permission-denied-although-crw-rw-rw-1-root-root-1-3

https://unix.stackexchange.com/questions/146633/bash-dev-null-permission-denied

你可能感兴趣的:(Linux,bash,/dev/null,Permission,denied)