[root@termtest etc]# su nagios
could not open session
Problem, unable to su to a different account. When you login as root and try to access a different account by issuing the su command you get the error “could not open session”.
Today this problem occurred on one of the redhat Linux servers after restoring the /etc/passwd and the /etc/shadow file from backup. The problem is that the permissions on the /etc/passwd file are not set correctly.
If you experience this problem and you do a check on the file you will most likely see something similar as in this example:
[root@termtest etc]# ls -rtl
passwd -rw------- 1 root root 1871 Mar 6 16:35 passwd
The correct permission on the file should be:
-rw-r--r-- 1 root root 1871 Mar 6 16:35 passwd
To correct this you should invoke the chmod command to change the permissions on the file.
[root@ termtest etc]# chmod 644 passwd
This will solve the problem and will enable you to su to an other user.