Announcement

Collapse
No announcement yet.

USB screw ups

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nasty7
    replied
    Don't worry GregM, I've had issues like this too. I think I did it myself a few times pulling out a USB Prematurely, or inserting on boot by accident...due to impatience surely. I also use Windows, so that may be an issue also, as was said. I've even had Windows scan and fix the USB a few times, can you believe that! lol

    As much as I like Kubuntu I've had lot's of little glitches.

    Leave a comment:


  • GregM
    replied
    I'd sure like to know too, so I never do it again.

    Leave a comment:


  • oshunluvr
    replied
    I'm curious as to what would have caused this. My best guess is reboots or system crashes with USB drives mounted, but odd that they were names "usb1", "usb2", etc. IME, removable drives mount with their label or a PARTID

    Leave a comment:


  • GregM
    replied
    rmdir /media/usb*

    That seems to have worked

    AND
    my thumb drive seems to be working...at least for now

    What a relief
    Thank you

    Leave a comment:


  • oshunluvr
    replied
    Originally posted by GregM View Post
    Tried it and got this...

    greg@greg-OptiPlex-990:~$ sudo -i
    [sudo] password for greg:
    root@greg-OptiPlex-990:~# rm -f /media/usb*
    rm: cannot remove '/media/usb0': Is a directory
    rm: cannot remove '/media/usb1': Is a directory
    rm: cannot remove '/media/usb2': Is a directory
    rm: cannot remove '/media/usb3': Is a directory
    rm: cannot remove '/media/usb4': Is a directory
    rm: cannot remove '/media/usb5': Is a directory
    rm: cannot remove '/media/usb6': Is a directory
    rm: cannot remove '/media/usb7': Is a directory
    root@greg-OptiPlex-990:~#
    Oh sorry, should have been either

    rm -rf /media/usb*

    or

    rmdir /media/usb*

    THe first one would also delete any of those folders with something in it. The second will only remove empty folders.

    Leave a comment:


  • GregM
    replied
    Originally posted by oshunluvr View Post
    Yeah, well I agree with that. However, all those other folders and files have zero to do with your desire to change the ownership and permission of /media/greg. I'm not picking on you, I just don't understand why you would want to mess with a system created folder and then not expect some problems.

    Clearly, some shenanigans have occurred with regard to this mess you have. Also it appears you have been able to change the group of the /media/greg folder. Probably because the group of the /media folder is changed and it's inheriting the ownership from there. I'm not sure what impact that will have, if any.

    So I guess I missed the part where you remove all that other stuff?

    So does this not work?

    Code:
    sudo -i 
    rm -f /media/usb*
    [S]rm -f /media/.hidden[/S]
    [S]rm -f /media/.directory[/S]
    I've never seen random folders and links under /media before unless a user put them there.
    Tried it and got this...

    greg@greg-OptiPlex-990:~$ sudo -i
    [sudo] password for greg:
    root@greg-OptiPlex-990:~# rm -f /media/usb*
    rm: cannot remove '/media/usb0': Is a directory
    rm: cannot remove '/media/usb1': Is a directory
    rm: cannot remove '/media/usb2': Is a directory
    rm: cannot remove '/media/usb3': Is a directory
    rm: cannot remove '/media/usb4': Is a directory
    rm: cannot remove '/media/usb5': Is a directory
    rm: cannot remove '/media/usb6': Is a directory
    rm: cannot remove '/media/usb7': Is a directory
    root@greg-OptiPlex-990:~#

    Leave a comment:


  • oshunluvr
    replied
    Weird because I don't, but Neon 18.04 here. Could be some application made them

    They're links to folders that I don't have. I'll have to check my Kubuntu install.

    EDIT: Yup, they're on my Kubuntu install so I guess leave those two...

    Leave a comment:


  • Qqmike
    replied
    /media/.directory
    /media/.hidden
    I also have those system files (in a stock 18.04).

    Leave a comment:


  • oshunluvr
    replied
    Yeah, well I agree with that. However, all those other folders and files have zero to do with your desire to change the ownership and permission of /media/greg. I'm not picking on you, I just don't understand why you would want to mess with a system created folder and then not expect some problems.

    Clearly, some shenanigans have occurred with regard to this mess you have. Also it appears you have been able to change the group of the /media/greg folder. Probably because the group of the /media folder is changed and it's inheriting the ownership from there. I'm not sure what impact that will have, if any.

    So I guess I missed the part where you remove all that other stuff?

    So does this not work?

    Code:
    sudo -i 
    rm -f /media/usb*
    [S]rm -f /media/.hidden[/S]
    [S]rm -f /media/.directory[/S]
    I've never seen random folders and links under /media before unless a user put them there.
    Last edited by oshunluvr; Dec 14, 2018, 08:17 PM.

    Leave a comment:


  • GregM
    replied
    Originally posted by oshunluvr View Post
    No need to do that and it's not crazy. There's no need to change this. If you reinstall, it's going to be the same because it's that way by design. You can't change it because it's permissions and ownership are "locked" and you're not using the correct command to unlock it first.

    It is locked because you (you the empirical user, not specifically you Greg) are not supposed to be mucking about in the media folder. It's done that way to keep other users from accessing your removable devices. When you insert a device root (via UDEV) mounts the device in your /media/greg folder with permission that you can access.

    Here's what my /media folder looks like with nothing mounted:
    Code:
    [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ ll /media[/COLOR]
    total 0
    drwxr-xr-x  1 root root  12 Nov  9 08:26 [COLOR=#5454FF][B].[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x  1 root root 268 Nov 23 08:50 [COLOR=#5454FF][B]..[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-x---+ 1 root root   0 Dec  2 19:45 [COLOR=#5454FF][B]stuart[/B][/COLOR][COLOR=#000000]/[/COLOR][/FONT]
    (NOTE: I believe this user folder under /media is created when you log in. Thus, multiple users could have a folder in there at the same time if a second "session" is created)

    Clearly, root owns the stuart folder and the zero after "root root" shows us nothing is in the stuart folder. Now with a device inserted and mounted, we see:
    Code:
    [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ ll /media/[/COLOR]
    total 0
    drwxr-xr-x  1 root root  12 Nov  9 08:26 [COLOR=#5454FF][B].[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x  1 root root 268 Nov 23 08:50 [COLOR=#5454FF][B]..[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-x---+ 1 root root  22 Dec 14 15:59 [COLOR=#5454FF][B]stuart[/B][/COLOR][COLOR=#000000]/[/COLOR][/FONT]
    The zero has changed to 22, indicating some stuff is under stuart now, and here it is:
    Code:
    [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ ll /media/stuart/[/COLOR]
    total 4
    drwxr-x---+ 1 root   root     22 Dec 14 15:59  [COLOR=#5454FF][B].[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x  1 root   root     12 Nov  9 08:26  [COLOR=#5454FF][B]..[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxrwxrwx  1 stuart stuart 4096 Dec 13 11:42 [COLOR=#1818b2]'Samsung USB'[/COLOR][COLOR=#000000]/[/COLOR][/FONT]
    Notice the ownership and permissions of my thumb drive mount point are fully open to me. Thus, having /media/stuart restricted to only those in my group (which is only me by Ubuntu default) prevents others from accessing my devices while they're mounted there. I don't understand why you think you need to change this because it works fine (and is more secure) if you leave it alone, but anyway...

    ...the short answer as to why you can't change the folder the way you're trying is an "Access Control List" (ACL) is being used. The hint is the plus sign trailing the normal permissions list. Look at mine and see (I enlarged the plus sign):
    Code:
    [FONT=monospace][COLOR=#000000]drwxr-x---[SIZE=4][B]+[/B][/SIZE] 1 root root  22 Dec 14 15:59 [/COLOR][COLOR=#5454FF][B]stuart[/B][/COLOR][COLOR=#000000]/[/COLOR][/FONT]
    If you look at the ACL you'll see:

    Code:
    [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ getfacl /media/stuart    [/COLOR]
    getfacl: Removing leading '/' from absolute path names
    # file: media/stuart
    # owner: root
    # group: root
    [B]user::rwx
    user:stuart:r-x[/B]
    group::---
    mask::r-x
    other::---[/FONT]


    So you can see that although root "owns" the folder, I have been given access through the ACL.

    To further general ACL knowledge and possibly to give you a better understanding of what you're encountering: https://linuxconfig.org/how-to-manage-acls-on-linux

    If you really, really, REALLY want to continue mucking about, go right ahead - it's your system. However, at least generally, changing things in your linux install basically just because you don't like the way it looks is a bad idea IMO. I know because I've done numerous re-installs over the last 20 years that I've used linux for blindly taking the same sort of actions.

    My advice, if you want it, is ask yourself why you're doing something before finding out how to do it, and then only act when your understanding is clear and your reasons justified.
    I tried to duplicate what you did and here is the result...

    greg@greg-OptiPlex-990:~$ ll /media

    total 44
    drwxr-xr-x 11 root greg 4096 Dec 1 10:12 ./
    drwxr-xr-x 24 root root 4096 Dec 3 12:57 ../
    lrwxrwxrwx 1 root greg 45 Sep 8 16:07 .directory -> /etc/kubuntu-default-settings/directory-media
    drwxr-xr-x+ 2 root greg 4096 Dec 14 15:29 greg/
    lrwxrwxrwx 1 root greg 42 Sep 8 16:07 .hidden -> /etc/kubuntu-default-settings/hidden-media
    lrwxrwxrwx 1 root greg 4 Dec 1 10:12 usb -> usb0/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb0/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb1/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb2/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb3/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb4/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb5/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb6/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb7/

    greg@greg-OptiPlex-990:~$

    With thumb drive inserted...

    greg@greg-OptiPlex-990:~$ ll /media/

    total 44
    drwxr-xr-x 11 root greg 4096 Dec 1 10:12 ./
    drwxr-xr-x 24 root root 4096 Dec 3 12:57 ../
    lrwxrwxrwx 1 root greg 45 Sep 8 16:07 .directory -> /etc/kubuntu-default-settings/directory-media
    drwxr-xr-x+ 2 root greg 4096 Dec 14 15:29 greg/
    lrwxrwxrwx 1 root greg 42 Sep 8 16:07 .hidden -> /etc/kubuntu-default-settings/hidden-media
    lrwxrwxrwx 1 root greg 4 Dec 1 10:12 usb -> usb0/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb0/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb1/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb2/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb3/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb4/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb5/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb6/
    drwxr-xr-x 2 root greg 4096 Dec 1 10:12 usb7/

    greg@greg-OptiPlex-990:~$

    greg@greg-OptiPlex-990:~$ getfacl /media/greg

    getfacl: Removing leading '/' from absolute path names
    # file: media/greg
    # owner: root
    # group: greg
    user::rwx
    user:greg:r-x
    group::---
    mask::r-x
    other::r-x

    greg@greg-OptiPlex-990:~$

    The only reason I'm doing anything is because I can't write anything to my thumb drives.
    If they would just work I would not be doing anything as I prefer to be just a "user" and not a tinkerer

    Leave a comment:


  • GregM
    replied
    Originally posted by SpecialEd View Post
    Use command lsblk to show your path/mount point.
    greg@greg-OptiPlex-990:~$ lsblk

    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 83.9G 0 disk
    └─sda1 8:1 0 83.9G 0 part /
    sdb 8:16 1 7.3G 0 disk
    └─sdb1 8:17 1 7.3G 0 part /media/greg/8GB
    sr0 11:0 1 1024M 0 rom

    greg@greg-OptiPlex-990:~$

    Leave a comment:


  • Snowhog
    replied
    Originally posted by GregM View Post
    So
    sudo chown $USER:$USER /media/<username>/<mountpoint>
    would be
    sudo chown $greg:$greg /media/greg/8gb
    ?
    No. $USER is an environment variable that translates to the current logged in user; you. If you specify your login name directly, don't put a $ in front of it. Incorrect: $greg Correct: greg

    Leave a comment:


  • oshunluvr
    replied
    Originally posted by GregM View Post
    I'm about ready to reformat and start over.
    This is crazy
    No need to do that and it's not crazy. There's no need to change this. If you reinstall, it's going to be the same because it's that way by design. You can't change it because it's permissions and ownership are "locked" and you're not using the correct command to unlock it first.

    It is locked because you (you the empirical user, not specifically you Greg) are not supposed to be mucking about in the media folder. It's done that way to keep other users from accessing your removable devices. When you insert a device root (via UDEV) mounts the device in your /media/greg folder with permission that you can access.

    Here's what my /media folder looks like with nothing mounted:
    Code:
    [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ ll /media[/COLOR]
    total 0
    drwxr-xr-x  1 root root  12 Nov  9 08:26 [COLOR=#5454FF][B].[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x  1 root root 268 Nov 23 08:50 [COLOR=#5454FF][B]..[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-x---+ 1 root root   0 Dec  2 19:45 [COLOR=#5454FF][B]stuart[/B][/COLOR][COLOR=#000000]/[/COLOR][/FONT]
    (NOTE: I believe this user folder under /media is created when you log in. Thus, multiple users could have a folder in there at the same time if a second "session" is created)

    Clearly, root owns the stuart folder and the zero after "root root" shows us nothing is in the stuart folder. Now with a device inserted and mounted, we see:
    Code:
    [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ ll /media/[/COLOR]
    total 0
    drwxr-xr-x  1 root root  12 Nov  9 08:26 [COLOR=#5454FF][B].[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x  1 root root 268 Nov 23 08:50 [COLOR=#5454FF][B]..[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-x---+ 1 root root  22 Dec 14 15:59 [COLOR=#5454FF][B]stuart[/B][/COLOR][COLOR=#000000]/[/COLOR][/FONT]
    The zero has changed to 22, indicating some stuff is under stuart now, and here it is:
    Code:
    [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ ll /media/stuart/[/COLOR]
    total 4
    drwxr-x---+ 1 root   root     22 Dec 14 15:59  [COLOR=#5454FF][B].[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x  1 root   root     12 Nov  9 08:26  [COLOR=#5454FF][B]..[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxrwxrwx  1 stuart stuart 4096 Dec 13 11:42 [COLOR=#1818b2]'Samsung USB'[/COLOR][COLOR=#000000]/[/COLOR][/FONT]
    Notice the ownership and permissions of my thumb drive mount point are fully open to me. Thus, having /media/stuart restricted to only those in my group (which is only me by Ubuntu default) prevents others from accessing my devices while they're mounted there. I don't understand why you think you need to change this because it works fine (and is more secure) if you leave it alone, but anyway...

    ...the short answer as to why you can't change the folder the way you're trying is an "Access Control List" (ACL) is being used. The hint is the plus sign trailing the normal permissions list. Look at mine and see (I enlarged the plus sign):
    Code:
    [FONT=monospace][COLOR=#000000]drwxr-x---[SIZE=4][B]+[/B][/SIZE] 1 root root  22 Dec 14 15:59 [/COLOR][COLOR=#5454FF][B]stuart[/B][/COLOR][COLOR=#000000]/[/COLOR][/FONT]
    If you look at the ACL you'll see:

    Code:
    [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ getfacl /media/stuart    [/COLOR]
    getfacl: Removing leading '/' from absolute path names
    # file: media/stuart
    # owner: root
    # group: root
    [B]user::rwx
    user:stuart:r-x[/B]
    group::---
    mask::r-x
    other::---[/FONT]


    So you can see that although root "owns" the folder, I have been given access through the ACL.

    To further general ACL knowledge and possibly to give you a better understanding of what you're encountering: https://linuxconfig.org/how-to-manage-acls-on-linux

    If you really, really, REALLY want to continue mucking about, go right ahead - it's your system. However, at least generally, changing things in your linux install basically just because you don't like the way it looks is a bad idea IMO. I know because I've done numerous re-installs over the last 20 years that I've used linux for blindly taking the same sort of actions.

    My advice, if you want it, is ask yourself why you're doing something before finding out how to do it, and then only act when your understanding is clear and your reasons justified.
    Last edited by oshunluvr; Dec 14, 2018, 03:27 PM.

    Leave a comment:


  • SpecialEd
    replied
    Use command lsblk to show your path/mount point.

    Leave a comment:


  • GregM
    replied
    I'm about ready to reformat and start over.
    This is crazy

    Leave a comment:

Users Viewing This Topic

Collapse

There are 0 users viewing this topic.

Working...
X