0

I'm confused by "permission denied" despite apparently having correct permissions to /dev/bus/usb/005/017.

This is similar to this question, but I have already tried restarting my ssh session.

$ sudo ls -la  /dev/bus/usb/005/
total 0
drw-rw-rw- 2 root root      120 Dec 25 12:40 .
drw-rw-rw- 7 root root      140 Apr 20  2010 ..
crw-rw-rw- 1 root root 189, 512 Dec 25 12:20 001
crw-rw-rw- 1 root root 189, 515 Dec 25 12:20 004
crw-rw-rw- 1 root root 189, 516 Dec 25 12:20 005
crw-rw-rw- 1 root adb  189, 528 Dec 25 12:40 017 #adb group, g+rw

$ groups ealfonso
ealfonso : ealfonso cdrom floppy audio dip video plugdev netdev scanner bluetooth adb # I am in adb group

$ ls -la  /dev/bus/usb/005/017
ls: cannot access /dev/bus/usb/005/017: Permission denied


$ sudo chown ealfonso:ealfonso /dev/bus/usb/005/017 

$ sudo ls -l /dev/bus/usb/005/017
crw-rw-rw- 1 ealfonso ealfonso 189, 528 Dec 25 12:40 /dev/bus/usb/005/017 #owned by ealfonso

$ ls /dev/bus/usb/005/017
ls: cannot access /dev/bus/usb/005/017: Permission denied

What am I missing?

Edit: adding output of ls -ld as requested:

$ sudo ls -lad  /dev/bus/usb/005
drw-rw-rw- 2 root root 120 Dec 25 12:40 /dev/bus/usb/005 #missing a+x

$ sudo chmod a+x /dev/bus/usb/005 # add a+x

$ ls -la  /dev/bus/usb/005/017 # still denied
ls: cannot access /dev/bus/usb/005/017: Permission denied

$ sudo ls -lad  /dev/bus/usb/005
drwxrwxrwx 2 root ealfonso 120 Dec 25 12:40 /dev/bus/usb/005

Edit. As pointed out in the comments, /dev/bus/usb was also missing x permissions

$ ls /dev/bus/usb -l
ls: cannot access /dev/bus/usb/005: Permission denied
ls: cannot access /dev/bus/usb/004: Permission denied
ls: cannot access /dev/bus/usb/003: Permission denied
ls: cannot access /dev/bus/usb/002: Permission denied
ls: cannot access /dev/bus/usb/001: Permission denied
total 0
d????????? ? ? ? ?            ? 001
d????????? ? ? ? ?            ? 002
d????????? ? ? ? ?            ? 003
d????????? ? ? ? ?            ? 004
d????????? ? ? ? ?            ? 005

$ sudo ls /dev/bus/usb -l
total 0
drw-rw-rw- 2 root root      60 Apr 20  2010 001
drw-rw-rw- 2 root root      80 Apr 20  2010 002
drw-rw-rw- 2 root root      60 Apr 20  2010 003
drw-rw-rw- 2 root root      60 Apr 20  2010 004
drwxrwxrwx 2 root ealfonso 120 Dec 25 12:40 005

$ sudo chmod a+x /dev/bus/usb 

$ ls -la  /dev/bus/usb/005/017
crw-rw-rw- 1 root ealfonso 189, 528 Dec 25 13:43 /dev/bus/usb/005/017
  • 1
    Please add the output of ls -ld /dev/bus/usb/005. I suspect a problem with that (missing execute permission?). – Celada Dec 25 '16 at 21:15
  • 2
    We're on to something. x permission was missing on /dev/bus/usb/005. You added it, but it didn't help. I guess it's probably missing somewhere else too. Let's try ls -ld /dev/bus/usb and ls -ld /dev/bus, ls -ld /dev, and ls -ld /. It would surprise me very much if the last two had problematic permissions; it's probably one of the first 2. – Celada Dec 25 '16 at 21:30
  • could you add as an answer? – user84207 Dec 25 '16 at 21:45
  • Yeah. I was using comments because at first I was speculating :) – Celada Dec 25 '16 at 22:08
2

Here's part of your output:

ls -la  /dev/bus/usb/005/017
ls: cannot access /dev/bus/usb/005/017: Permission denied

Hint: you can always stat a file as long as you can get to it (via the directory that contains it), even if you don't have permission to it. So with this, I suspected that your problem was not actually with /dev/bus/usb/005/017 itself.

Getting access to the file in order to be able to stat it is a matter of having x (execute) access to all the directories in the pathname. That is,

/
/dev
/dev/bus
/dev/bus/usb
/dev/bus/usb/005

One or more of those directories must be missing x permission. But probably not / or /dev as your system would probably be unusable if the problem lay there. Note that any or all of those directories may have r access, allowing you to see what files they contain but not get at those files.

Why were your /dev/bus/usb/005 and /dev/bus/usb missing x permission?

Those directories will have been created when udev first created the device nodes and their parent directories. Perhaps the umask on the udev daemon is too strict? I'm not really sure why that would be on your system. For correct operation, none of the octal digits in the umask should be odd. Note that the problem might be with the udevd started at early boot time in the initramfs.

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.