What's new

Weird problem with 'ls' and permissions

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

J Story

New Around Here
Yesterday, when I ssh'ed into my N66U (v 3.0.0.4.374 (.32, I think)), all was well. Today, however, when I entered 'ls', all I saw was '.'.

I eventually discovered that I could see files by entering 'ls /*', but not 'ls *' -- that is, absolute pathnames seemed to work okay. The next oddity is that when I entered 'ls -al /*' I saw this:


[admin@RT-N66U root]$ ls -al /*
?-------w- 0 16877 2 0 Dec 31 1969 /bin
?------r-- 0 16877 2 0 Dec 31 1969 /cifs1
?------rw- 0 16877 2 0 Dec 31 1969 /cifs2
?-wx--x--- 0 17407 4 0 Dec 31 1969 /dev
?r----xrwt 0 41471 1 0 Dec 31 1969 /etc
?r----xrwT 0 41471 1 0 Dec 31 1969 /home
?------r-x 0 16877 2 0 Dec 31 1969 /jffs
?--x-w--wx 0 16877 3 0 Dec 31 1969 /lib
?--x-wxrw- 0 16877 2 0 Dec 31 1969 /mmc
?r----s-w- 0 41471 1 0 Dec 31 1969 /mnt
?r----x--- 0 41471 1 0 Dec 31 1969 /opt
?--------x 0 16749 70 0 Dec 31 1969 /proc
?--x-wxr-x 0 16877 6 0 Dec 31 1969 /rom
?-w-rwSr-t 0 41471 1 0 Dec 31 1969 /root
?--------x 0 16877 2 0 Dec 31 1969 /sbin
?--------x 0 16877 10 0 Dec 31 1969 /sys
?---rw--w- 0 16877 2 0 Dec 31 1969 /sysroot
?-wx---rwx 0 16895 10 0 Dec 31 1969 /tmp
?----wx-wx 0 16877 7 0 Dec 31 1969 /usr
?-w-rwSrwT 0 41471 1 0 Dec 31 1969 /var
?---rw---x 0 16877 10 0 Dec 31 1969 /www
[admin@RT-N66U root]$


I don't understand what the question marks are doing there, and the permissions look funny (although that could be normal.)

I upgraded the firmware to ...34, but nothing changed.

Any clues as to what is going on, and even more importantly, how to fix it? As far as I can tell, the router is otherwise working correctly.
 
"*" doesn't work the way you expect it under Linux. The correct wildcard pattern is ".*". And if the goal is to view the list of file at the root, then there should not be any wildcard pattern.

Your display oddities are probably caused by whichever terminal you are using - try a different one, or check the emulation you are using.
 
"*" doesn't work the way you expect it under Linux. The correct wildcard pattern is ".*".

Guess it depends how you expect "*" to work!, ".*" finds hidden files. The default location when you ssh in is empty (in Tomato at least, so you need to specify a folder in the file system with something!

Code:
root@rtn66u:/tmp/home/root# ls
root@rtn66u:/tmp/home/root#

if you want to see a lot try

Code:
ls -FlasheR /
 
I don't understand what the question marks are doing there, and the permissions look funny (although that could be normal.)

That is one seriously messed-up directory listing. In addition to permissions, you're showing numeric user and group instead of names.

My nice normal root directory looks like this:

Code:
admin@RT-N66U:/# ls -al /
drwxr-xr-x   16 admin    root           217 Aug 24 19:39 .
drwxr-xr-x   16 admin    root           217 Aug 24 19:39 ..
drwxr-xr-x    2 admin    root           559 Aug 24 19:39 bin
drwxr-xr-x    2 admin    root             3 Aug 24 19:39 cifs1
drwxr-xr-x    2 admin    root             3 Aug 24 19:39 cifs2
drwxrwxrwt    4 admin    root          1860 Oct 19 15:00 dev
lrwxrwxrwx    1 admin    root             7 Aug 24 19:39 etc -> tmp/etc
lrwxrwxrwx    1 admin    root             8 Aug 24 19:39 home -> tmp/home
drwxr-xr-x    6 admin    root             0 Dec 31  1969 jffs
drwxr-xr-x    3 admin    root           354 Aug 24 19:39 lib
drwxr-xr-x    2 admin    root             3 Aug 24 19:39 mmc
lrwxrwxrwx    1 admin    root             7 Aug 24 19:39 mnt -> tmp/mnt
lrwxrwxrwx    1 admin    root             7 Aug 24 19:39 opt -> tmp/opt
dr-xr-xr-x   73 admin    root             0 Dec 31  1999 proc
drwxr-xr-x    6 admin    root           663 Aug 24 19:39 rom
lrwxrwxrwx    1 admin    root            13 Aug 24 19:39 root -> tmp/home/root
drwxr-xr-x    2 admin    root          1636 Aug 24 19:39 sbin
drwxr-xr-x   10 admin    root             0 Dec 31  1999 sys
drwxrwxrwx   10 admin    root           640 Oct 30 23:53 tmp
drwxr-xr-x    7 admin    root            96 Aug 24 19:39 usr
lrwxrwxrwx    1 admin    root             7 Aug 24 19:39 var -> tmp/var
drwxr-xr-x   10 admin    root          4929 Aug 24 19:39 www
I would clear NVRAM and reinstall the firmware if I saw a listing as weird as yours.
 
Thanks ... still worried / confused

Thanks for the advice about clearing NVRAM and reinstalling. I'll go look for how to do that so I don't turn the router into an expensive brick.

As for others, I grok Linux, and have used it for maybe ten years. What worries me is the change from one day where everything is normal to the next, where the permissions got garbled. Barring some malware somewhere, I am the only one with access.

As an FYI, there was one more strange oddity that preceded this. I had installed 'bash' via ipkg, and had a script that depended on it, and it ran okay for a couple weeks. Then, a few days before this mess happened, 'bash' disappeared. In a way, it seems like my router has Alzheimer's.

Anyway, thanks.
 
For a final word on this, I think the problem was the USB flash drive. Reformatting it set things right again.

Maybe it's time for some new flash memory.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top