Permission problem on /media/user folder prevents me from accessing external media












10















When I plug in my external Hard drive, insert a DVD, or try to see what I've got on my USB drive, peculiar behavior is the usual outcome.



The filesystems mount fine. When I log in as root through sudo su, I can see the contents of the /media/casper/externaldrive perfectly fine. My user however, casper, can't. Ubuntu replies to every action that involves the location Permission denied:



casper@casper-desktop:/media$ ll /media/casper/externaldrive
ls: cannot access '/media/casper/externaldrive': Permission denied


I decided to do some digging into the permission (problems) of the /media folder. As casper, I see the following:



casper@casper-desktop:/media$ ls -alF
total 16
drwxr-xr-x 4 root root 4096 apr 21 17:47 ./
drwxr-xr-x 25 root root 4096 jul 29 15:43 ../
drwxr-x--- 3 root root 4096 aug 3 21:02 casper/
lrwxrwxrwx 1 root root 45 apr 21 17:47 .directory -> /etc/kubuntu-default-settings/directory-media
lrwxrwxrwx 1 root root 42 apr 21 17:47 .hidden -> /etc/kubuntu-default-settings/hidden-media
drwxr-xr-x 2 root root 4096 feb 29 23:56 home/


What struck me was that it said total 16, while there are only at most 6 listings. So I ran the command again, but as root. The result was the same, weird. (can anyone enlighten me on this?)



Anyway, what struck me even more was that the /media/casper directory is not mine and also can't be accessed by me. I got tempted to just chown -R the bazinkas out of it, but after I got a hold of myself I googled something like "Media user folder not mine help me".



It took a while but finally I stumbled upon this thread, where users explain the purpose of 750 root:root /media/user folders. It makes sure only root can mount, view and manage filesystems there, of which the individual permissions are changed to the actual user.



So if my information was correct, the /media/casper/externaldrive permissions should be favorable for me. I checked,



root@casper-desktop:/media/casper# ll
total 12
drwxr-x--- 3 root root 4096 aug 3 21:02 ./
drwxr-xr-x 4 root root 4096 apr 21 17:47 ../
drwxrwxrwx 1 casper casper 4096 aug 3 20:20 externaldrive/


And this seems to be the case.



So this is where I'm stuck. The filesystem has permissions for me all the way through the directory tree, yet I can't access a single file. This is the same for CD's and USB drives.



Who can help me access my precious?



Oh, and by the way. Aforementioned thread speaks of ACL on these /media/user folders, indicated by a + after the regular permissions, like drwxr-x---+ 3 root root. My system does not show this. Is ACL on these folders standard for Ubuntu or did the user have special things going on, and should I be worried that this is where my problem comes from?



Thanks for reading.










share|improve this question




















  • 1





    I use a dual boot setup (16.04 and Win7) and I see a + at the end of the permissions of folder /media/user. So I think there's where your problem comes from. I found these (1, 2) through googleing but I haven't used acl before to know if they are enough to solve your issue.

    – Karsus
    Aug 9 '16 at 16:57








  • 2





    The ls total count 1kB blocks used by the files in the directory, non-recursively. See unix.stackexchange.com/a/4110/44281 .

    – amotzg
    Aug 9 '16 at 21:04











  • @Karsus Thank you, I think you've found my problem. I'm going to try Zanna's answer below and will keep you updated. @ amotzg Aha, that clears things up. Thanks :)

    – MicroParsec
    Aug 11 '16 at 11:36













  • Just out of curiosity, what does "3" in drwxr-x--- 3* mean?

    – thephoenix01
    Feb 25 at 16:33
















10















When I plug in my external Hard drive, insert a DVD, or try to see what I've got on my USB drive, peculiar behavior is the usual outcome.



The filesystems mount fine. When I log in as root through sudo su, I can see the contents of the /media/casper/externaldrive perfectly fine. My user however, casper, can't. Ubuntu replies to every action that involves the location Permission denied:



casper@casper-desktop:/media$ ll /media/casper/externaldrive
ls: cannot access '/media/casper/externaldrive': Permission denied


I decided to do some digging into the permission (problems) of the /media folder. As casper, I see the following:



casper@casper-desktop:/media$ ls -alF
total 16
drwxr-xr-x 4 root root 4096 apr 21 17:47 ./
drwxr-xr-x 25 root root 4096 jul 29 15:43 ../
drwxr-x--- 3 root root 4096 aug 3 21:02 casper/
lrwxrwxrwx 1 root root 45 apr 21 17:47 .directory -> /etc/kubuntu-default-settings/directory-media
lrwxrwxrwx 1 root root 42 apr 21 17:47 .hidden -> /etc/kubuntu-default-settings/hidden-media
drwxr-xr-x 2 root root 4096 feb 29 23:56 home/


What struck me was that it said total 16, while there are only at most 6 listings. So I ran the command again, but as root. The result was the same, weird. (can anyone enlighten me on this?)



Anyway, what struck me even more was that the /media/casper directory is not mine and also can't be accessed by me. I got tempted to just chown -R the bazinkas out of it, but after I got a hold of myself I googled something like "Media user folder not mine help me".



It took a while but finally I stumbled upon this thread, where users explain the purpose of 750 root:root /media/user folders. It makes sure only root can mount, view and manage filesystems there, of which the individual permissions are changed to the actual user.



So if my information was correct, the /media/casper/externaldrive permissions should be favorable for me. I checked,



root@casper-desktop:/media/casper# ll
total 12
drwxr-x--- 3 root root 4096 aug 3 21:02 ./
drwxr-xr-x 4 root root 4096 apr 21 17:47 ../
drwxrwxrwx 1 casper casper 4096 aug 3 20:20 externaldrive/


And this seems to be the case.



So this is where I'm stuck. The filesystem has permissions for me all the way through the directory tree, yet I can't access a single file. This is the same for CD's and USB drives.



Who can help me access my precious?



Oh, and by the way. Aforementioned thread speaks of ACL on these /media/user folders, indicated by a + after the regular permissions, like drwxr-x---+ 3 root root. My system does not show this. Is ACL on these folders standard for Ubuntu or did the user have special things going on, and should I be worried that this is where my problem comes from?



Thanks for reading.










share|improve this question




















  • 1





    I use a dual boot setup (16.04 and Win7) and I see a + at the end of the permissions of folder /media/user. So I think there's where your problem comes from. I found these (1, 2) through googleing but I haven't used acl before to know if they are enough to solve your issue.

    – Karsus
    Aug 9 '16 at 16:57








  • 2





    The ls total count 1kB blocks used by the files in the directory, non-recursively. See unix.stackexchange.com/a/4110/44281 .

    – amotzg
    Aug 9 '16 at 21:04











  • @Karsus Thank you, I think you've found my problem. I'm going to try Zanna's answer below and will keep you updated. @ amotzg Aha, that clears things up. Thanks :)

    – MicroParsec
    Aug 11 '16 at 11:36













  • Just out of curiosity, what does "3" in drwxr-x--- 3* mean?

    – thephoenix01
    Feb 25 at 16:33














10












10








10


1






When I plug in my external Hard drive, insert a DVD, or try to see what I've got on my USB drive, peculiar behavior is the usual outcome.



The filesystems mount fine. When I log in as root through sudo su, I can see the contents of the /media/casper/externaldrive perfectly fine. My user however, casper, can't. Ubuntu replies to every action that involves the location Permission denied:



casper@casper-desktop:/media$ ll /media/casper/externaldrive
ls: cannot access '/media/casper/externaldrive': Permission denied


I decided to do some digging into the permission (problems) of the /media folder. As casper, I see the following:



casper@casper-desktop:/media$ ls -alF
total 16
drwxr-xr-x 4 root root 4096 apr 21 17:47 ./
drwxr-xr-x 25 root root 4096 jul 29 15:43 ../
drwxr-x--- 3 root root 4096 aug 3 21:02 casper/
lrwxrwxrwx 1 root root 45 apr 21 17:47 .directory -> /etc/kubuntu-default-settings/directory-media
lrwxrwxrwx 1 root root 42 apr 21 17:47 .hidden -> /etc/kubuntu-default-settings/hidden-media
drwxr-xr-x 2 root root 4096 feb 29 23:56 home/


What struck me was that it said total 16, while there are only at most 6 listings. So I ran the command again, but as root. The result was the same, weird. (can anyone enlighten me on this?)



Anyway, what struck me even more was that the /media/casper directory is not mine and also can't be accessed by me. I got tempted to just chown -R the bazinkas out of it, but after I got a hold of myself I googled something like "Media user folder not mine help me".



It took a while but finally I stumbled upon this thread, where users explain the purpose of 750 root:root /media/user folders. It makes sure only root can mount, view and manage filesystems there, of which the individual permissions are changed to the actual user.



So if my information was correct, the /media/casper/externaldrive permissions should be favorable for me. I checked,



root@casper-desktop:/media/casper# ll
total 12
drwxr-x--- 3 root root 4096 aug 3 21:02 ./
drwxr-xr-x 4 root root 4096 apr 21 17:47 ../
drwxrwxrwx 1 casper casper 4096 aug 3 20:20 externaldrive/


And this seems to be the case.



So this is where I'm stuck. The filesystem has permissions for me all the way through the directory tree, yet I can't access a single file. This is the same for CD's and USB drives.



Who can help me access my precious?



Oh, and by the way. Aforementioned thread speaks of ACL on these /media/user folders, indicated by a + after the regular permissions, like drwxr-x---+ 3 root root. My system does not show this. Is ACL on these folders standard for Ubuntu or did the user have special things going on, and should I be worried that this is where my problem comes from?



Thanks for reading.










share|improve this question
















When I plug in my external Hard drive, insert a DVD, or try to see what I've got on my USB drive, peculiar behavior is the usual outcome.



The filesystems mount fine. When I log in as root through sudo su, I can see the contents of the /media/casper/externaldrive perfectly fine. My user however, casper, can't. Ubuntu replies to every action that involves the location Permission denied:



casper@casper-desktop:/media$ ll /media/casper/externaldrive
ls: cannot access '/media/casper/externaldrive': Permission denied


I decided to do some digging into the permission (problems) of the /media folder. As casper, I see the following:



casper@casper-desktop:/media$ ls -alF
total 16
drwxr-xr-x 4 root root 4096 apr 21 17:47 ./
drwxr-xr-x 25 root root 4096 jul 29 15:43 ../
drwxr-x--- 3 root root 4096 aug 3 21:02 casper/
lrwxrwxrwx 1 root root 45 apr 21 17:47 .directory -> /etc/kubuntu-default-settings/directory-media
lrwxrwxrwx 1 root root 42 apr 21 17:47 .hidden -> /etc/kubuntu-default-settings/hidden-media
drwxr-xr-x 2 root root 4096 feb 29 23:56 home/


What struck me was that it said total 16, while there are only at most 6 listings. So I ran the command again, but as root. The result was the same, weird. (can anyone enlighten me on this?)



Anyway, what struck me even more was that the /media/casper directory is not mine and also can't be accessed by me. I got tempted to just chown -R the bazinkas out of it, but after I got a hold of myself I googled something like "Media user folder not mine help me".



It took a while but finally I stumbled upon this thread, where users explain the purpose of 750 root:root /media/user folders. It makes sure only root can mount, view and manage filesystems there, of which the individual permissions are changed to the actual user.



So if my information was correct, the /media/casper/externaldrive permissions should be favorable for me. I checked,



root@casper-desktop:/media/casper# ll
total 12
drwxr-x--- 3 root root 4096 aug 3 21:02 ./
drwxr-xr-x 4 root root 4096 apr 21 17:47 ../
drwxrwxrwx 1 casper casper 4096 aug 3 20:20 externaldrive/


And this seems to be the case.



So this is where I'm stuck. The filesystem has permissions for me all the way through the directory tree, yet I can't access a single file. This is the same for CD's and USB drives.



Who can help me access my precious?



Oh, and by the way. Aforementioned thread speaks of ACL on these /media/user folders, indicated by a + after the regular permissions, like drwxr-x---+ 3 root root. My system does not show this. Is ACL on these folders standard for Ubuntu or did the user have special things going on, and should I be worried that this is where my problem comes from?



Thanks for reading.







usb permissions hard-drive dvd media






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:24









Community

1




1










asked Aug 3 '16 at 20:11









MicroParsecMicroParsec

1621115




1621115








  • 1





    I use a dual boot setup (16.04 and Win7) and I see a + at the end of the permissions of folder /media/user. So I think there's where your problem comes from. I found these (1, 2) through googleing but I haven't used acl before to know if they are enough to solve your issue.

    – Karsus
    Aug 9 '16 at 16:57








  • 2





    The ls total count 1kB blocks used by the files in the directory, non-recursively. See unix.stackexchange.com/a/4110/44281 .

    – amotzg
    Aug 9 '16 at 21:04











  • @Karsus Thank you, I think you've found my problem. I'm going to try Zanna's answer below and will keep you updated. @ amotzg Aha, that clears things up. Thanks :)

    – MicroParsec
    Aug 11 '16 at 11:36













  • Just out of curiosity, what does "3" in drwxr-x--- 3* mean?

    – thephoenix01
    Feb 25 at 16:33














  • 1





    I use a dual boot setup (16.04 and Win7) and I see a + at the end of the permissions of folder /media/user. So I think there's where your problem comes from. I found these (1, 2) through googleing but I haven't used acl before to know if they are enough to solve your issue.

    – Karsus
    Aug 9 '16 at 16:57








  • 2





    The ls total count 1kB blocks used by the files in the directory, non-recursively. See unix.stackexchange.com/a/4110/44281 .

    – amotzg
    Aug 9 '16 at 21:04











  • @Karsus Thank you, I think you've found my problem. I'm going to try Zanna's answer below and will keep you updated. @ amotzg Aha, that clears things up. Thanks :)

    – MicroParsec
    Aug 11 '16 at 11:36













  • Just out of curiosity, what does "3" in drwxr-x--- 3* mean?

    – thephoenix01
    Feb 25 at 16:33








1




1





I use a dual boot setup (16.04 and Win7) and I see a + at the end of the permissions of folder /media/user. So I think there's where your problem comes from. I found these (1, 2) through googleing but I haven't used acl before to know if they are enough to solve your issue.

– Karsus
Aug 9 '16 at 16:57







I use a dual boot setup (16.04 and Win7) and I see a + at the end of the permissions of folder /media/user. So I think there's where your problem comes from. I found these (1, 2) through googleing but I haven't used acl before to know if they are enough to solve your issue.

– Karsus
Aug 9 '16 at 16:57






2




2





The ls total count 1kB blocks used by the files in the directory, non-recursively. See unix.stackexchange.com/a/4110/44281 .

– amotzg
Aug 9 '16 at 21:04





The ls total count 1kB blocks used by the files in the directory, non-recursively. See unix.stackexchange.com/a/4110/44281 .

– amotzg
Aug 9 '16 at 21:04













@Karsus Thank you, I think you've found my problem. I'm going to try Zanna's answer below and will keep you updated. @ amotzg Aha, that clears things up. Thanks :)

– MicroParsec
Aug 11 '16 at 11:36







@Karsus Thank you, I think you've found my problem. I'm going to try Zanna's answer below and will keep you updated. @ amotzg Aha, that clears things up. Thanks :)

– MicroParsec
Aug 11 '16 at 11:36















Just out of curiosity, what does "3" in drwxr-x--- 3* mean?

– thephoenix01
Feb 25 at 16:33





Just out of curiosity, what does "3" in drwxr-x--- 3* mean?

– thephoenix01
Feb 25 at 16:33










2 Answers
2






active

oldest

votes


















13





+50









Since the permissions & ownership of /media/casper are



drwxr-x---  root root 


With no + for ACLs (Access Control Lists) it's clear that only root can open, enter, read or write to this directory. Humble users like us get the permissions at the end of the string --- :(



We unprivileged folk get permission to access this location with ACLs. I am not sure why you don't have these already, but you can set them up, which may be simple or require a little tinkering:




  • the acl package is required (check apt-cache policy acl)

  • the filesystem must be mounted with the acl option


To check the latter (replace sdxY appropriately for your root partition):



sudo tune2fs -l /dev/sdxY | grep "Default mount options:"


should return:



Default mount options:    user_xattr acl


Default mount options are set in /etc/mke2fs.conf



They may be overridden, so check:



cat /proc/mounts | grep sdxY


looks something like:



/dev/sdxY / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0


The above is fine, (acl doesn't need to be mentioned) but if it says noacl you need to change it.



You can add the option to default mount options like this:



sudo tune2fs -o acl /dev/sdxY


Or you can add acl to the options for the root partition line in /etc/fstab for example:



UUID=whatever /     ext4    errors=remount-ro,acl    0       1


With ACLs enabled, use setfacl to add permissions for yourself. To give username read and execute permissions on /media/casper (you need execute permission to enter a directory or search its contents):



sudo setfacl -m u:username:rx /media/casper


You can replace username with uid (probably you are 1000 - check with id command)



sudo setfacl -m u:1000:rx /media/casper


to see the ACL permissions you use getfacl like Oli did in his answer



getfacl /media/casper


To remove ACL permissions from a user



sudo setfacl -x u:username /media/casper


To clear all ACL permissions



sudo setfacl -b /media/casper




Note: I cheated and asked a question myself about why there are so many entries in /media. The answer is here






share|improve this answer





















  • 1





    Thank you @Zanna: apt-cache policy acl returns ACL is installed and latest. Default mount options mentions acl. cat /proc/mount does not mention noacl. So I guess I need to add the ACL permissions manually now, as for some reason they are unmade. I used the commands you described to give myself rx permissions for the /media/casper directory and I'm glad to say I can access my external media again. Thank you Zanna!

    – MicroParsec
    Aug 11 '16 at 11:47













  • Yay, happy you got it fixed :D

    – Zanna
    Aug 11 '16 at 12:09



















2














When you want to give access permission to a Windows drive from Ubuntu



The normal chmod command won't work if it is a Windows NTFS drive.



The following works for me.



Open the file /etc/mtab:



gedit /etc/mtab


Find the drive name in this file (just mouse over on drive for which you are looking for solution, in my case the GUI is showing different name and on mouse over it shows /media/user-name/drive-name)



Now in /etc/mtab:



Search the drive-name in file, and check to which drive your mounted drive is assigned (in my case - /dev/sda4)



Now mount this drive with:



sudo ntfs-3g /dev/sda4 /media/"$USER"


Now I am able to execute my executables, but I won't be able to see contents of drive-name, so I unmounted the drive and mounted it again.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f806762%2fpermission-problem-on-media-user-folder-prevents-me-from-accessing-external-med%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    13





    +50









    Since the permissions & ownership of /media/casper are



    drwxr-x---  root root 


    With no + for ACLs (Access Control Lists) it's clear that only root can open, enter, read or write to this directory. Humble users like us get the permissions at the end of the string --- :(



    We unprivileged folk get permission to access this location with ACLs. I am not sure why you don't have these already, but you can set them up, which may be simple or require a little tinkering:




    • the acl package is required (check apt-cache policy acl)

    • the filesystem must be mounted with the acl option


    To check the latter (replace sdxY appropriately for your root partition):



    sudo tune2fs -l /dev/sdxY | grep "Default mount options:"


    should return:



    Default mount options:    user_xattr acl


    Default mount options are set in /etc/mke2fs.conf



    They may be overridden, so check:



    cat /proc/mounts | grep sdxY


    looks something like:



    /dev/sdxY / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0


    The above is fine, (acl doesn't need to be mentioned) but if it says noacl you need to change it.



    You can add the option to default mount options like this:



    sudo tune2fs -o acl /dev/sdxY


    Or you can add acl to the options for the root partition line in /etc/fstab for example:



    UUID=whatever /     ext4    errors=remount-ro,acl    0       1


    With ACLs enabled, use setfacl to add permissions for yourself. To give username read and execute permissions on /media/casper (you need execute permission to enter a directory or search its contents):



    sudo setfacl -m u:username:rx /media/casper


    You can replace username with uid (probably you are 1000 - check with id command)



    sudo setfacl -m u:1000:rx /media/casper


    to see the ACL permissions you use getfacl like Oli did in his answer



    getfacl /media/casper


    To remove ACL permissions from a user



    sudo setfacl -x u:username /media/casper


    To clear all ACL permissions



    sudo setfacl -b /media/casper




    Note: I cheated and asked a question myself about why there are so many entries in /media. The answer is here






    share|improve this answer





















    • 1





      Thank you @Zanna: apt-cache policy acl returns ACL is installed and latest. Default mount options mentions acl. cat /proc/mount does not mention noacl. So I guess I need to add the ACL permissions manually now, as for some reason they are unmade. I used the commands you described to give myself rx permissions for the /media/casper directory and I'm glad to say I can access my external media again. Thank you Zanna!

      – MicroParsec
      Aug 11 '16 at 11:47













    • Yay, happy you got it fixed :D

      – Zanna
      Aug 11 '16 at 12:09
















    13





    +50









    Since the permissions & ownership of /media/casper are



    drwxr-x---  root root 


    With no + for ACLs (Access Control Lists) it's clear that only root can open, enter, read or write to this directory. Humble users like us get the permissions at the end of the string --- :(



    We unprivileged folk get permission to access this location with ACLs. I am not sure why you don't have these already, but you can set them up, which may be simple or require a little tinkering:




    • the acl package is required (check apt-cache policy acl)

    • the filesystem must be mounted with the acl option


    To check the latter (replace sdxY appropriately for your root partition):



    sudo tune2fs -l /dev/sdxY | grep "Default mount options:"


    should return:



    Default mount options:    user_xattr acl


    Default mount options are set in /etc/mke2fs.conf



    They may be overridden, so check:



    cat /proc/mounts | grep sdxY


    looks something like:



    /dev/sdxY / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0


    The above is fine, (acl doesn't need to be mentioned) but if it says noacl you need to change it.



    You can add the option to default mount options like this:



    sudo tune2fs -o acl /dev/sdxY


    Or you can add acl to the options for the root partition line in /etc/fstab for example:



    UUID=whatever /     ext4    errors=remount-ro,acl    0       1


    With ACLs enabled, use setfacl to add permissions for yourself. To give username read and execute permissions on /media/casper (you need execute permission to enter a directory or search its contents):



    sudo setfacl -m u:username:rx /media/casper


    You can replace username with uid (probably you are 1000 - check with id command)



    sudo setfacl -m u:1000:rx /media/casper


    to see the ACL permissions you use getfacl like Oli did in his answer



    getfacl /media/casper


    To remove ACL permissions from a user



    sudo setfacl -x u:username /media/casper


    To clear all ACL permissions



    sudo setfacl -b /media/casper




    Note: I cheated and asked a question myself about why there are so many entries in /media. The answer is here






    share|improve this answer





















    • 1





      Thank you @Zanna: apt-cache policy acl returns ACL is installed and latest. Default mount options mentions acl. cat /proc/mount does not mention noacl. So I guess I need to add the ACL permissions manually now, as for some reason they are unmade. I used the commands you described to give myself rx permissions for the /media/casper directory and I'm glad to say I can access my external media again. Thank you Zanna!

      – MicroParsec
      Aug 11 '16 at 11:47













    • Yay, happy you got it fixed :D

      – Zanna
      Aug 11 '16 at 12:09














    13





    +50







    13





    +50



    13




    +50





    Since the permissions & ownership of /media/casper are



    drwxr-x---  root root 


    With no + for ACLs (Access Control Lists) it's clear that only root can open, enter, read or write to this directory. Humble users like us get the permissions at the end of the string --- :(



    We unprivileged folk get permission to access this location with ACLs. I am not sure why you don't have these already, but you can set them up, which may be simple or require a little tinkering:




    • the acl package is required (check apt-cache policy acl)

    • the filesystem must be mounted with the acl option


    To check the latter (replace sdxY appropriately for your root partition):



    sudo tune2fs -l /dev/sdxY | grep "Default mount options:"


    should return:



    Default mount options:    user_xattr acl


    Default mount options are set in /etc/mke2fs.conf



    They may be overridden, so check:



    cat /proc/mounts | grep sdxY


    looks something like:



    /dev/sdxY / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0


    The above is fine, (acl doesn't need to be mentioned) but if it says noacl you need to change it.



    You can add the option to default mount options like this:



    sudo tune2fs -o acl /dev/sdxY


    Or you can add acl to the options for the root partition line in /etc/fstab for example:



    UUID=whatever /     ext4    errors=remount-ro,acl    0       1


    With ACLs enabled, use setfacl to add permissions for yourself. To give username read and execute permissions on /media/casper (you need execute permission to enter a directory or search its contents):



    sudo setfacl -m u:username:rx /media/casper


    You can replace username with uid (probably you are 1000 - check with id command)



    sudo setfacl -m u:1000:rx /media/casper


    to see the ACL permissions you use getfacl like Oli did in his answer



    getfacl /media/casper


    To remove ACL permissions from a user



    sudo setfacl -x u:username /media/casper


    To clear all ACL permissions



    sudo setfacl -b /media/casper




    Note: I cheated and asked a question myself about why there are so many entries in /media. The answer is here






    share|improve this answer















    Since the permissions & ownership of /media/casper are



    drwxr-x---  root root 


    With no + for ACLs (Access Control Lists) it's clear that only root can open, enter, read or write to this directory. Humble users like us get the permissions at the end of the string --- :(



    We unprivileged folk get permission to access this location with ACLs. I am not sure why you don't have these already, but you can set them up, which may be simple or require a little tinkering:




    • the acl package is required (check apt-cache policy acl)

    • the filesystem must be mounted with the acl option


    To check the latter (replace sdxY appropriately for your root partition):



    sudo tune2fs -l /dev/sdxY | grep "Default mount options:"


    should return:



    Default mount options:    user_xattr acl


    Default mount options are set in /etc/mke2fs.conf



    They may be overridden, so check:



    cat /proc/mounts | grep sdxY


    looks something like:



    /dev/sdxY / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0


    The above is fine, (acl doesn't need to be mentioned) but if it says noacl you need to change it.



    You can add the option to default mount options like this:



    sudo tune2fs -o acl /dev/sdxY


    Or you can add acl to the options for the root partition line in /etc/fstab for example:



    UUID=whatever /     ext4    errors=remount-ro,acl    0       1


    With ACLs enabled, use setfacl to add permissions for yourself. To give username read and execute permissions on /media/casper (you need execute permission to enter a directory or search its contents):



    sudo setfacl -m u:username:rx /media/casper


    You can replace username with uid (probably you are 1000 - check with id command)



    sudo setfacl -m u:1000:rx /media/casper


    to see the ACL permissions you use getfacl like Oli did in his answer



    getfacl /media/casper


    To remove ACL permissions from a user



    sudo setfacl -x u:username /media/casper


    To clear all ACL permissions



    sudo setfacl -b /media/casper




    Note: I cheated and asked a question myself about why there are so many entries in /media. The answer is here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 13 '17 at 12:23









    Community

    1




    1










    answered Aug 9 '16 at 17:54









    ZannaZanna

    51.1k13138242




    51.1k13138242








    • 1





      Thank you @Zanna: apt-cache policy acl returns ACL is installed and latest. Default mount options mentions acl. cat /proc/mount does not mention noacl. So I guess I need to add the ACL permissions manually now, as for some reason they are unmade. I used the commands you described to give myself rx permissions for the /media/casper directory and I'm glad to say I can access my external media again. Thank you Zanna!

      – MicroParsec
      Aug 11 '16 at 11:47













    • Yay, happy you got it fixed :D

      – Zanna
      Aug 11 '16 at 12:09














    • 1





      Thank you @Zanna: apt-cache policy acl returns ACL is installed and latest. Default mount options mentions acl. cat /proc/mount does not mention noacl. So I guess I need to add the ACL permissions manually now, as for some reason they are unmade. I used the commands you described to give myself rx permissions for the /media/casper directory and I'm glad to say I can access my external media again. Thank you Zanna!

      – MicroParsec
      Aug 11 '16 at 11:47













    • Yay, happy you got it fixed :D

      – Zanna
      Aug 11 '16 at 12:09








    1




    1





    Thank you @Zanna: apt-cache policy acl returns ACL is installed and latest. Default mount options mentions acl. cat /proc/mount does not mention noacl. So I guess I need to add the ACL permissions manually now, as for some reason they are unmade. I used the commands you described to give myself rx permissions for the /media/casper directory and I'm glad to say I can access my external media again. Thank you Zanna!

    – MicroParsec
    Aug 11 '16 at 11:47







    Thank you @Zanna: apt-cache policy acl returns ACL is installed and latest. Default mount options mentions acl. cat /proc/mount does not mention noacl. So I guess I need to add the ACL permissions manually now, as for some reason they are unmade. I used the commands you described to give myself rx permissions for the /media/casper directory and I'm glad to say I can access my external media again. Thank you Zanna!

    – MicroParsec
    Aug 11 '16 at 11:47















    Yay, happy you got it fixed :D

    – Zanna
    Aug 11 '16 at 12:09





    Yay, happy you got it fixed :D

    – Zanna
    Aug 11 '16 at 12:09













    2














    When you want to give access permission to a Windows drive from Ubuntu



    The normal chmod command won't work if it is a Windows NTFS drive.



    The following works for me.



    Open the file /etc/mtab:



    gedit /etc/mtab


    Find the drive name in this file (just mouse over on drive for which you are looking for solution, in my case the GUI is showing different name and on mouse over it shows /media/user-name/drive-name)



    Now in /etc/mtab:



    Search the drive-name in file, and check to which drive your mounted drive is assigned (in my case - /dev/sda4)



    Now mount this drive with:



    sudo ntfs-3g /dev/sda4 /media/"$USER"


    Now I am able to execute my executables, but I won't be able to see contents of drive-name, so I unmounted the drive and mounted it again.






    share|improve this answer






























      2














      When you want to give access permission to a Windows drive from Ubuntu



      The normal chmod command won't work if it is a Windows NTFS drive.



      The following works for me.



      Open the file /etc/mtab:



      gedit /etc/mtab


      Find the drive name in this file (just mouse over on drive for which you are looking for solution, in my case the GUI is showing different name and on mouse over it shows /media/user-name/drive-name)



      Now in /etc/mtab:



      Search the drive-name in file, and check to which drive your mounted drive is assigned (in my case - /dev/sda4)



      Now mount this drive with:



      sudo ntfs-3g /dev/sda4 /media/"$USER"


      Now I am able to execute my executables, but I won't be able to see contents of drive-name, so I unmounted the drive and mounted it again.






      share|improve this answer




























        2












        2








        2







        When you want to give access permission to a Windows drive from Ubuntu



        The normal chmod command won't work if it is a Windows NTFS drive.



        The following works for me.



        Open the file /etc/mtab:



        gedit /etc/mtab


        Find the drive name in this file (just mouse over on drive for which you are looking for solution, in my case the GUI is showing different name and on mouse over it shows /media/user-name/drive-name)



        Now in /etc/mtab:



        Search the drive-name in file, and check to which drive your mounted drive is assigned (in my case - /dev/sda4)



        Now mount this drive with:



        sudo ntfs-3g /dev/sda4 /media/"$USER"


        Now I am able to execute my executables, but I won't be able to see contents of drive-name, so I unmounted the drive and mounted it again.






        share|improve this answer















        When you want to give access permission to a Windows drive from Ubuntu



        The normal chmod command won't work if it is a Windows NTFS drive.



        The following works for me.



        Open the file /etc/mtab:



        gedit /etc/mtab


        Find the drive name in this file (just mouse over on drive for which you are looking for solution, in my case the GUI is showing different name and on mouse over it shows /media/user-name/drive-name)



        Now in /etc/mtab:



        Search the drive-name in file, and check to which drive your mounted drive is assigned (in my case - /dev/sda4)



        Now mount this drive with:



        sudo ntfs-3g /dev/sda4 /media/"$USER"


        Now I am able to execute my executables, but I won't be able to see contents of drive-name, so I unmounted the drive and mounted it again.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 17 at 19:33









        Zanna

        51.1k13138242




        51.1k13138242










        answered Oct 27 '17 at 12:17









        HridaynathHridaynath

        25924




        25924






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f806762%2fpermission-problem-on-media-user-folder-prevents-me-from-accessing-external-med%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?