I came across a weird case when I am working today. But, I am able to solve the problem in a minute. Just hope that I can share it out. The problem sounds as like below.
login as: hiuy
Last login: Fri Jun 7 09:01:01 2013 from 16.189.90.136
-bash: /etc/profile: Permission denied
-bash-3.2$
-bash-3.2$ id
uid=121738973 gid=6347 groups=10,6347,12132,12178
-bash-3.2$ whoami
whoami: cannot find name for user ID 121738973
[root@test ~]# ls -al /etc/passwd /etc/shadow /etc/group
-rw-r--r-- 1 root root 29575 Jun 7 08:02 /etc/passwd
-rw-r--r-- 1 root root 4368 Jun 7 08:55 /etc/group
-r-------- 1 root root 9012 Jun 7 08:02 /etc/shadow
The permission for the three important files are perfectly looks okay. So, What is the fault??
This is the hint....
-bash-3.2$ ls -al /etc/passwd
ls: /etc/passwd: Permission denied
The Answer is here...
[root@test /]# ls -al | grep etc
drwx------ 89 root root 12288 Jun 7 08:55 etc
etc is having 700 only. No permission for mortal user to read and accessing /etc/passwd! So, chmod it to 755 /etc, and that's the end of the story!
This is cunning, but I like it....
No comments:
Post a Comment