0

I tried to tab complete something and I guess it wasnt there. I know you are not supposed to set the permissions to /etc/ like that, but my permissions seem to be all messed up. whoami prints out cannot find name for user ID 1002 and I cannot cd into /etc/ anymore. passwd and shadow use 640 and 644 so I am not sure why this is a problem. Regardless, is there any way to fix this?

The command run was sudo chmod 644 /etc/

I have no name!@vpn-server:/$ whoami
whoami: cannot find name for user ID 1002


I have no name!@vpn-server:/$ cd etc
bash: cd: etc: Permission denied

I have no name!@vpn-server:/$ ls -al etc
d????????? ? ? ? ?                ? .
d????????? ? ? ? ?                ? ..
d????????? ? ? ? ?                ? acpi
-????????? ? ? ? ?                ? adduser.conf

I have no name!@vpn-server:/$ sudo su
sudo: can't open /etc/sudoers: Permission denied
  • Your question is very unclear. What exactly is the problem? Did someone type chmod 644 /etc? Did they add a -R in there as well? What happened specifically? – UtahJarhead Oct 8 '12 at 3:02
  • there was no -R. The command was: sudo chmod 644 /etc/ – Franz Payer Oct 8 '12 at 3:05
2

First off all your question is unclear. but still see this...

your /etc directory permission is 644 ie:chmod 644 /etc/

To change Directory execute permission is required

That's why you are getting this error

I have no name!@vpn-server:/$ cd etc

bash: cd: etc: Permission denied

so change the permission to chmod 755 /etc

2nd thing ls -al showing this type of output (d????????? ? ? ? ?) because


I have no name!@vpn-server:/$ ls -al etc
d????????? ? ? ? ?                ? .
d????????? ? ? ? ?                ? ..
d????????? ? ? ? ?                ? acpi
-????????? ? ? ? ?                ? adduser.conf

To long list a directory read and execute permission is required for directory.

For below error just post /etc/passwd file entry for the id 1002

I have no name!@vpn-server:/$ whoami

whoami: cannot find name for user ID 1002

0

If the permissions were set on /etc itself to be 644 then just type this: chmod 755 /etc

If the permissions were set recursively... you've got a much deeper problem than just that.

  • Yah, I don't have permissions to do that. Was chmod 644 /etc/ the same as chmod 644 /etc -r ? – Franz Payer Oct 8 '12 at 3:17
  • No, it is not the same as -R (capital R). If -R had been specified, it also would have hosed up pretty much any config file your system uses. Fixing that would be nigh impossible to do correctly. Since it's only /etc, just change the perms to 755 and you SHOULD be golden. – UtahJarhead Oct 8 '12 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.