看来我需要使用我拥有并具有 r/w 权限的目录sudo
。ls
如果我尝试访问ls
我的媒体驱动器,我可以看到它,但看不到它的子目录,即使我认为拥有该子目录应该能让我这样做。当我尝试时,我得到了这个结果:
me@icvr1:/home$ ls -al /media/
total 12
drwxrwxrwx 3 root root 4096 Dec 20 11:05 .
drwxr-xr-x 25 root root 4096 Dec 19 12:41 ..
drw-rw-rw-+ 4 me me 4096 Jan 4 12:01 innovationcommons
me@icvr1:/home$ ls -al /media/innovationcommons/
ls: cannot access '/media/innovationcommons/External_Storage': Permission denied
ls: cannot access '/media/innovationcommons/DataStorage': Permission denied
ls: cannot access '/media/innovationcommons/..': Permission denied
ls: cannot access '/media/innovationcommons/.': Permission denied
total 0
d????????? ? ? ? ? ? .
d????????? ? ? ? ? ? ..
d????????? ? ? ? ? ? DataStorage
d????????? ? ? ? ? ? External_Storage
me@icvr1:/home$ ls -al /media/innovationcommons/DataStorage
ls: cannot access '/media/innovationcommons/DataStorage': Permission denied
但是,如果我使用sudo
,我会得到这个更令人期待和有用的结果:
me@icvr1:/home$ sudo ls -al /media/innovationcommons/
[sudo] password for me:
total 16
drw-rw-rw-+ 4 me me 4096 Jan 4 12:01 .
drwxrwxrwx 3 root root 4096 Dec 20 11:05 ..
drwxrwxrwx 1 me me 4096 Jan 3 13:35 DataStorage
drw-rw-rw- 4 me me 4096 Aug 29 11:33 External_Storage
me@icvr1:/home$ sudo ls -al /media/innovationcommons/DataStorage
total 16
drwxrwxrwx 1 me me 4096 Jan 3 13:35 .
drw-rw-rw-+ 4 me me 4096 Jan 4 12:01 ..
drwxrwxrwx 1 me me 4096 Jan 2 16:08 Images
drwxrwxrwx 1 me me 496 Jan 3 13:37 Places
drwxrwxrwx 1 me me 0 Dec 12 14:53 $RECYCLE.BIN
drwxrwxrwx 1 me me 4096 Dec 12 14:54 System Volume Information
ls -al /media/innovationcommons
为什么不使用sudo
,甚至只是ls
它的子目录就不能成功?
您没有文件夹的执行位。
另请参阅:执行与读取位。Linux 中的目录权限是如何工作的?