Unix server treats the login with message "-bash: /dev/null: Permission denied"
search cancel

Unix server treats the login with message "-bash: /dev/null: Permission denied"

book

Article ID: 295629

calendar_today

Updated On:

Products

VMware Tanzu Greenplum

Issue/Introduction

Symptoms:

Connecting to the Unix box via the user (i.e say gpadmin) errors out with the below message:
 

[root@xxx ~]# su - gpadmin
-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

This indicates the bash that is needed to set the profile is not working, which also yields to the problem of not setting the environment (defined at .bash_profile or .profile ) after you connect.
 

Since the environment is not set , the gpssh / gpstate or other greenplum utility would now fail with messages for eg.s like this.

[gpadmin@### ~]$ gpstate
sh: /dev/null: Permission denied
20150210:09:46:59:013478 gpstate:###00slm0001:gpadmin-[INFO]:-Starting gpstate with args:
20150210:09:46:59:013478 gpstate:###00slm0001:gpadmin-[CRITICAL]:-gpstate failed. (Reason='[Errno 2] No such file or directory: '/postgresql.conf'') exiting...

 

Environment


Cause

The cause is due to the corrupted /dev/null file, the corruption can be caused may be due some one modified the file or some one did some alteration to the /dev/null or moved something to the /dev/null which corrupted the file.

[root@###00slm0001 gpadmin]# ls -ltr /dev/null
crw-rw-r-- 1 root utmp 1, 3 Feb  9 08:23 /dev/null

 

Resolution

Restart the server and this should fix the problem

-OR-

The permission of the /dev/null should be 666 , if for some reason its not 666 then change the permission using
 

[root@### gpadmin]# chmod 666 /dev/null

-OR-

if after changing the permission, the issue still exists then remove and recreate the NULL file
 

[root@### gpadmin]# rm /dev/null 
[root@### gpadmin]# mknod -m 666 /dev/null c 1 3
[root@### gpadmin]# ls -ltr /dev/null
crw-rw-rw- 1 root root 1, 3 Feb 10 10:03 /dev/null
[root@### gpadmin]# chown root:utmp /dev/null

Even after the changes mentioned above, the /dev/null is still being modified would request to enable the audit on /dev/null as indicated on the Red Hat knowledge base