LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Confusing access permission.../$ can read ls .../# cannot ??? (https://www.linuxquestions.org/questions/linux-newbie-8/confusing-access-permission-%24-can-read-ls-cannot-4175678450/)

Greymug 07-09-2020 08:47 PM

Confusing access permission.../$ can read ls .../# cannot ???
 
Distro: Linux Mint 19-3 Tricia -
The following is very confusing:
---------------------------------------------------------------------
root@HPLap:/home/garyh/virtual-drives/1# ls
ls: cannot open directory '.': Permission denied
root@HPLap:/home/garyh/virtual-drives/1# exit
exit
garyh@HPLap:~/virtual-drives/1$ ls
boot casper dists EFI isolinux MD5SUMS pool preseed README.diskdefines
garyh@HPLap:~/virtual-drives/1$ sudo su
root@HPLap:/home/garyh/virtual-drives/1# cd
root@HPLap:~# chmod 777 /home/garyh/virtual-drives/1
chmod: cannot access '/home/garyh/virtual-drives/1': Permission denied
root@HPLap:~#
---------------------------------------------------------------------
These replies totally confused me. I am trying to remove the virtual drive '1'. I;d like to know how to remove/prevent virtual drives from running at all.

cordx 07-09-2020 09:17 PM

Quote:

Originally Posted by Greymug (Post 6143633)
garyh@HPLap:~/virtual-drives/1$ ls
boot casper dists EFI isolinux MD5SUMS pool preseed README.diskdefines

it would probably help to see the permissions by using ls -al.

Greymug 07-09-2020 09:26 PM

re-worked:
--------------------------------------------------------------------------------------------------------
root@HPLap:/home/garyh/virtual-drives# ls -l
ls: cannot access '1': Permission denied
total 0
d????????? ? ? ? ? ? 1
root@HPLap:/home/garyh/virtual-drives# exit
exit
garyh@HPLap:~/virtual-drives/1$ ls -l
total 18
dr-xr-xr-x 1 root root 2048 Jun 24 18:59 boot
dr-xr-xr-x 1 root root 2048 Jun 24 18:59 casper
dr-xr-xr-x 1 root root 2048 Jun 24 18:59 dists
dr-xr-xr-x 1 root root 2048 Jun 24 18:59 EFI
dr-xr-xr-x 1 root root 26624 Jun 24 18:59 isolinux
-r--r--r-- 1 root root 33620 Jun 24 19:00 MD5SUMS
dr-xr-xr-x 1 root root 2048 Jun 24 18:59 pool
dr-xr-xr-x 1 root root 2048 Jun 24 18:59 preseed
-r--r--r-- 1 root root 221 Jun 24 18:59 README.diskdefines
garyh@HPLap:~/virtual-drives/1$
---------------------------------------------------------------------------------------------------------

cordx 07-09-2020 09:49 PM

Quote:

Originally Posted by Greymug (Post 6143641)
root@HPLap:/home/garyh
garyh@HPLap:~/virtual-drives/1$ ls -l

those two commands are running ls -l on different directories. from your regular user it would be helpful to see ls -l just on ~/virtual drives to see what the permissions of 1 (not its contents) are.

Greymug 07-09-2020 11:28 PM

from new terminal
------------------------------------------------------------
garyh@HPLap:~$ cd virtual-drives
garyh@HPLap:~/virtual-drives$ ls -l
total 1
dr-xr-xr-x 1 root root 2048 Jun 24 19:00 1
garyh@HPLap:~/virtual-drives$ sudo ls -l
[sudo] password for garyh:
ls: cannot access '1': Permission denied
total 0
d????????? ? ? ? ? ? 1
garyh@HPLap:~/virtual-drives$
-------------------------------------------------------------
Go figure..
how are these different directories?

cordx 07-09-2020 11:59 PM

Quote:

Originally Posted by Greymug (Post 6143633)
I am trying to remove the virtual drive '1'. I;d like to know how to remove/prevent virtual drives from running at all.

i missed that part initially and got focused on the permissions. what is creating the virtual drives to begin with?
Quote:

Originally Posted by Greymug (Post 6143659)
from new terminal
------------------------------------------------------------
garyh@HPLap:~$ cd virtual-drives
garyh@HPLap:~/virtual-drives$ ls -l
total 1
dr-xr-xr-x 1 root root 2048 Jun 24 19:00 1
garyh@HPLap:~/virtual-drives$ sudo ls -l
[sudo] password for garyh:
ls: cannot access '1': Permission denied
total 0
d????????? ? ? ? ? ? 1
garyh@HPLap:~/virtual-drives$
-------------------------------------------------------------
Go figure..
how are these different directories?

i don't have an absolute handle on permissions, but since root needs both x and r (see here and here)
Quote:

With the execute bit set you have the permission
  1. to cd into the directory
  2. Also for long listing ls -l i.e. to view the meta data of the files inside the directory (Provided that read permission is there for the directory.


Quote:

The execute bit (x) allows the affected user to enter the directory, and access files and directories inside
to ls -l a directory, i believe you need to keep looking at permissions up the directory structure. i.e. now ls -l /home to see what the permissions are for /virtual-drives.

Greymug 07-10-2020 01:08 AM

Originally I had a .iso to burn to cd. Somewhere (because a cd burner isn't installed with 19-3) I tried Acetoneiso and Furiusisomount without success until I dropped those and installed K3b. Then I noticed on my desktop that I acquired a Virtual device containing "1" active.
I've been trying to get rid of it since and ran into this mess (of my creation!) Tomorrow, I'll proceed as you suggest and will report back.

cordx 07-10-2020 01:30 AM

if they are still installed, you might open them to see if they show any hint of having created a virtual drive. if so, it would probably be easiest to delete through the program that created it. if not, deleting the program may do so. final fallback semi-nuclear option (if you can't figure out which directory's permission is holding up the works) could be to boot a live usb and see if sudo gets you access when the system isn't mounted.

Greymug 07-10-2020 08:28 AM

I uninstalled both of them. So the virtual-drives isn't a "Linux thing"?
I other attempts fail, I'll reinstall them and see if they (1 of 'em) hasa way to manage/delete 'em.

Greymug 07-10-2020 10:51 AM

I found a “Magic Cookie” in the directory containing “virtual-drives” which corresponded to the date & time I was working with Acetoneiso. So, I chmod 666 and removed it.
--------------------------------------------------------------------------------------
drwxrwxr-x 2 garyh garyh 4096 Jun 21 21:49 Public
drwx------ 2 garyh garyh 4096 Jun 25 09:13 .ssh
-rw-r--r-- 1 garyh garyh 0 Jun 21 21:55 .sudo_as_admin_successful
drwxr-xr-x 2 garyh garyh 4096 Jun 21 21:49 Templates
drwxrwxrwx 2 garyh garyh 4096 Jun 21 21:49 Videos
drwxrwxr-x 3 garyh garyh 4096 Jul 9 20:50 virtual-drives
-rw------- 1 garyh garyh 50 Jul 10 08:44 .Xauthority
-rw-rw-r-- 1 garyh garyh 131 Jun 25 15:30 .xinputrc
-rw------- 1 garyh garyh 7544 Jul 10 08:45 .xsession-errors
-rw------- 1 garyh garyh 60403 Jul 10 02:09 .xsession-errors.old
garyh@HPLap:~$ sudo su
[sudo] password for garyh:
root@HPLap:/home/garyh# cat -n .Xauthority
1 #HPLap#0#MIT-MAGIC-COOKIE-1#�#��R*�8]������root@HPLap:/home/garyh#
root@HPLap:/home/garyh# chmod 777 .Xauthority
----------------------------------------------------------------------------------------------------------------------------
I then, per your suggestion, checked/corrected permissions and removed contents and directories UNDER “Virtual-Drives”. I finally removed “virtual-drives” from the machine.
Thank you. Solved.


All times are GMT -5. The time now is 12:11 PM.