Skip to main content
Formatted slightly for readability. Tried to make it clearer: The title read as "Linux is command and directory privileges", not "Linux ls command and directory privileges". Removed meta information (this belongs in comments) - this is not a forum.
Source Link

The Linux ls'ls' command and directory privileges - cannot"cannot access /tmp/restricted/foo*: No such file or directorydirectory"

Would anyone be kind enough to explain whyWhy does one command workswork and the other doesn’t? I have found some remotely related articles, but I failed to understand them.

$ sudo ls -la /tmp/restricted
total 12
drwxr-x---.  2 root root    42 Mar 17 17:40 .
drwxrwxrwt. 12 root root 12288 Mar 17 17:37 ..
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo1
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo2
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo3 

$ sudo ls -a /tmp/restricted/foo*
ls: cannot access /tmp/restricted/foo*: No such file or directory
$

Note that if I change the privileges on /tmp/restricted to 755 instead of 750, both commands succeed:

$ sudo chmod 755 /tmp/restricted/ 

$ sudo ls -la /tmp/restricted
total 12
drwxr-xr-x.  2 root root    42 Mar 17 17:40 .
drwxrwxrwt. 12 root root 12288 Mar 17 17:37 ..
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo1
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo2
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo3 

$ sudo ls -a /tmp/restricted/foo*
/tmp/restricted/foo1  /tmp/restricted/foo2  /tmp/restricted/foo3
$

Thank you!

Linux ls command and directory privileges - cannot access /tmp/restricted/foo*: No such file or directory

Would anyone be kind enough to explain why one command works and the other doesn’t? I have found some remotely related articles, but I failed to understand them.

$ sudo ls -la /tmp/restricted
total 12
drwxr-x---.  2 root root    42 Mar 17 17:40 .
drwxrwxrwt. 12 root root 12288 Mar 17 17:37 ..
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo1
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo2
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo3
$ sudo ls -a /tmp/restricted/foo*
ls: cannot access /tmp/restricted/foo*: No such file or directory
$

Note that if I change the privileges on /tmp/restricted to 755 instead of 750, both commands succeed:

$ sudo chmod 755 /tmp/restricted/
$ sudo ls -la /tmp/restricted
total 12
drwxr-xr-x.  2 root root    42 Mar 17 17:40 .
drwxrwxrwt. 12 root root 12288 Mar 17 17:37 ..
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo1
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo2
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo3
$ sudo ls -a /tmp/restricted/foo*
/tmp/restricted/foo1  /tmp/restricted/foo2  /tmp/restricted/foo3
$

Thank you!

The Linux 'ls' command and directory privileges - "cannot access /tmp/restricted/foo*: No such file or directory"

Why does one command work and the other doesn’t? I have found some remotely related articles, but I failed to understand them.

$ sudo ls -la /tmp/restricted
total 12
drwxr-x---.  2 root root    42 Mar 17 17:40 .
drwxrwxrwt. 12 root root 12288 Mar 17 17:37 ..
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo1
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo2
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo3 

$ sudo ls -a /tmp/restricted/foo*
ls: cannot access /tmp/restricted/foo*: No such file or directory

Note that if I change the privileges on /tmp/restricted to 755 instead of 750, both commands succeed:

$ sudo chmod 755 /tmp/restricted/ 

$ sudo ls -la /tmp/restricted
total 12
drwxr-xr-x.  2 root root    42 Mar 17 17:40 .
drwxrwxrwt. 12 root root 12288 Mar 17 17:37 ..
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo1
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo2
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo3 

$ sudo ls -a /tmp/restricted/foo*
/tmp/restricted/foo1  /tmp/restricted/foo2  /tmp/restricted/foo3
Became Hot Network Question
Added sudo tag
Link
heuvy6
  • 33
  • 1
  • 3
Source Link
heuvy6
  • 33
  • 1
  • 3

Linux ls command and directory privileges - cannot access /tmp/restricted/foo*: No such file or directory

Would anyone be kind enough to explain why one command works and the other doesn’t? I have found some remotely related articles, but I failed to understand them.

$ sudo ls -la /tmp/restricted
total 12
drwxr-x---.  2 root root    42 Mar 17 17:40 .
drwxrwxrwt. 12 root root 12288 Mar 17 17:37 ..
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo1
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo2
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo3
$ sudo ls -a /tmp/restricted/foo*
ls: cannot access /tmp/restricted/foo*: No such file or directory
$

Note that if I change the privileges on /tmp/restricted to 755 instead of 750, both commands succeed:

$ sudo chmod 755 /tmp/restricted/
$ sudo ls -la /tmp/restricted
total 12
drwxr-xr-x.  2 root root    42 Mar 17 17:40 .
drwxrwxrwt. 12 root root 12288 Mar 17 17:37 ..
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo1
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo2
-rwxrwxr-x.  1 root tms      0 Mar 17 17:22 foo3
$ sudo ls -a /tmp/restricted/foo*
/tmp/restricted/foo1  /tmp/restricted/foo2  /tmp/restricted/foo3
$

Thank you!