Only Questionmarks in Linux dirlisting

LinuxTerminal

Linux Problem Overview


i'm doing a dir listing in my .ssh home dir which gives me a strange result:

ls -lsa .ssh/
total 0
? ?--------- ? ? ? ?            ? . ·
? ?--------- ? ? ? ?            ? .. ·
? ?--------- ? ? ? ?            ? authorized_keys ·

The weird thing is, that this only happens for one user and only in this specific directory. If I do the ls after a su -l, everything works as expected. Another strange thing is, that my xterm shows the dir listing in a red blinking font! Any ideas what's causing this to happen?

thx!

Edit:
Here is the dir listing as root:

ls -lsa
total 52
4 drw-------  2 sdd sdd 4096 Feb 10 15:57 .
4 drwx------ 16 sdd sdd 4096 Feb 10 15:57 ..
4 -rw-------  1 sdd sdd 1628 Feb 10 15:57 authorized_keys

I'm using ext3.

Edit2:
Thx for the answers, but i still get this:

chmod -R 600 /home/sdd/.ssh
ls -lsan _ssh.old/
total 0
? ?--------- ? ? ? ?            ? .
? ?--------- ? ? ? ?            ? ..
? ?--------- ? ? ? ?            ? authorized_keys

Linux Solutions


Solution 1 - Linux

That happens when the user can't do a stat() on the files (which requires execute permissions), but can read the directory entries (which requires read access on the directory). So you get a list of files in the directory, but can't get any information on the files because they can't be read. :) If you have a directory which has read permission but not execute, you'll see this. Someone probably tried to protect the .ssh directory incorrectly - it should be "chmod 0700 .ssh/" and owned by the user which owns the homedir. More than likely, someone was following instructions for securing a .ssh file but applied it to a .ssh directory. :)

If you do a chmod 0600 or 0400 on any directory, you can easily reproduce this behavior. Add execute permission to the dir, and it'll work fine.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSDDView Question on Stackoverflow
Solution 1 - LinuxdannysauerView Answer on Stackoverflow