Error opening directory media permission denied

I want to open files from a separate partition, usually accessed through /media in programs like Chromium or Inkspace. I get this error: Error opening directory '/media': Permission denied I have tried: gksudo nautilus (Terminal sat there and did not give me a command prompt or any other sign it still was alive) sudo chown user:user /media (tried changing user:user to user:, :user, and ::. All things gave me various error messages)
  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • Hardware
  • [ubuntu] Various thigs tried — Error opening directory ‘/media’: Permission denied

  1. Various thigs tried — Error opening directory ‘/media’: Permission denied

    I want to open files from a separate partition, usually accessed through /media in programs like Chromium or Inkspace. [edited out: I also want to be able to open my root folder.]

    I get this error: Error opening directory ‘/media’: Permission denied

    I have tried:

    • gksudo nautilus (Terminal sat there and did not give me a command prompt or any other sign it still was alive)
    • sudo chown user:user /media (tried changing user:user to user:[my user name], [my user name]:user, and [my user name]:[my user name]:[my user name]. All things gave me various error messages)
    • Change permission in the file explorer (nothing happened)

    I noticed that in the media folder there is a folder named [my user name]. It has a lock icon like on my root folder, which I also can’t access. The permissions say the owner is root.

    • The hard drive I am trying to acess is FAT32 and seen as detachable media
    • error: Error opening directory ‘/media’: Permission denied
    • Macbook Pro Mid 2009 15 inch
    • 2.53 GHz Intel Core 2 Duo
    • 8GB 1067 MHz DDR3
    • El Capitan 10.11.6 partition
    • Ubuntu 16.04 partition
    • 58 GB FAT32 partition
    • NOT USING BOOT CAMP

    Last edited by freedex; February 24th, 2020 at 09:55 PM.

    Reason: add info, take out wrong info


  2. Re: Various thigs tried — Error opening directory ‘/media’: Permission denied

    Ubuntu uses the /media/user directory as a mount point for external media such as flash drive or external drives. Do you have a sub-directory or directories at that location? I would not try to change ownership of /media, sub-directories under your user name would not be a problem. What type files are you trying to access with Chromium and Inkscape. You should be able to access /media/user as a normal user but not to write to in all likelihood. Doubt that is the problem though.

    Ubuntu like all Linux systems is designed as a multi-user system and the /root directory is not accessible to a normal user.

    If you tried to change ownership and got errors, you need to post the actual command and the output, the errors you got. I wouldn’t think there would be any problem accessing a FAT32 filesystem but I don’t know what you are trying to do in the software you mention.


  3. Re: Various thigs tried — Error opening directory ‘/media’: Permission denied

    Non-native file systems don’t support Unix permissions.

    The only way userid, groupid and permissions can be set is through mount options. Once mounted, the only way to modify them is to umount the storage and remount with different options. To see the mount options, run the mount command without any options and find the line for the portable media.

    Code:

    $ mount |grep vfat
    /dev/sdb1 on /media/tf/32G-PATRIOT type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

    that’s for a FAT32 32G flash drive. The uid/gid are critical and must match the output from the id command. This should be automatic. If not, something isn’t working normally.

    Recent Ubuntu releases have included a new package system called snaps. Snaps add many more constraints, like where on the file system the package/program can access. Chromium is one of these «snap» packages and by default it can only access the user’s HOME directory. If the snap package maintainer chooses, access to files under /media and /mnt can be requested. This is for higher security for high risk programs like a web browser.
    https://ubuntuforums.org/showthread….2#post13923022
    # Hook up snaps to access removable-media
    # snapd v2.36+.

    Code:

    snap connect chromium:removable-media

    https://snapcraft.io/docs/removable-media-interface
    That’s an example only for the chromium snap package. Other snaps may or may not allow the «snap connect» to removable-media. The team who creates the snap package decides which connect options are supported.

    Moving on …
    Running any file manager, like nautilus, caja, thunar and others, with elevated permissions can cause all sorts of issues.
    Similarly, changing permissions for directories outside of the user’s HOME is a common way to break any Unix system. There isn’t any script that will fix the permissions on the system files. A reinstall is almost always required, if excellent backups aren’t made in advance. For any Unix-like system, backups must include user, group, permissions and ACLs. Just copying files off is not a sufficient backup.

    I don’t know if nautilus is a snap package or not. Check using snap list

    What is my root folder? This is ambiguous. /root? /? or $HOME?

    Last edited by TheFu; February 22nd, 2020 at 02:18 AM.

    Reason: clarified due to later posts.


  4. Re: Various thigs tried — Error opening directory ‘/media’: Permission denied

    Quote Originally Posted by TheFu
    View Post

    that’s for a FAT32 32G flash drive. The uid/gid are critical and must match the output from the id command. This should be automatic.

    My output from the id command is uid=1000(compy) gid=1000(compy)

    Does this change the command I should use from your first code box?

    Quote Originally Posted by TheFu
    View Post

    I don’t know if nautilus is a snap package or not. Check using snap list

    From what you said, nautilus isn’t a command and I thought it was. I am guessing I would have needed to type inkspace, chromium, or whichever program where it said nautilus.

    snap list shows me that chromium, inkspace, libre office, skype, and vlc are in the list. I know chromium, inkspace, and libre office are programs that will not let me save files. Because of that, I am assuming snaps are the problem.

    Can I use just the commands below and be able to open and save files from my removeable hard drive?

    Or do I need to do the $ mount … command you have at the top of your reply first?
    If not, is there a use to doing that I don’t realize because I know little about these things? I mostly don’t want to brick my computer.

    Chromium

    Code:

    snap connect chromium:removable-media

    Other programs

    Code:

    sudo apt update
    sudo apt install [program]
    sudo snap remove [program]

    From what I have read from you two, I do not need to get into my /root folder, so I am not going to touch that. No way. I am just good enough with Linux to break stuff.


  5. Re: Various thigs tried — Error opening directory ‘/media’: Permission denied

    Quote Originally Posted by freedex
    View Post

    From what I have read from you two, I do not need to get into my /root folder, so I am not going to touch that. No way. I am just good enough with Linux to break stuff.

    /root/ isn’t important. It is just the HOME directory for the «root» account. It is only important if you put stuff into it. I put some configuration information there to be included in backups, but pretty much nothing else.

    / <—- the file system root **is** important. Don’t screw with it. That goes for any child directories under it too.

    nautilus is a GUI program. That is a command too. In most of the world «command» == «program»

    You shouldn’t copy/paste any commands provided by me or anyone else until you understand the command, all the options and what will happen when the command + options are run. As Ricky would say to Lucy — «you got some learnin’ to do, Lucy!»
    http://linuxcommand.org/tlcl.php has a free, no hassle, PDF book that should explain the commands well enough. If not, there are always manpages on your system for the specific version of the command on-your-system. Google results are for some variant of the command, which could be close enough or not to the actual version on your box. If you want to learn about the mount command


  6. Re: Various thigs tried — Error opening directory ‘/media’: Permission denied

    Quote Originally Posted by freedex
    View Post

    snap list shows me that chromium, inkspace, libre office, skype, and vlc are in the list. I know chromium, inkspace, and libre office are programs that will not let me save files. Because of that, I am assuming snaps are the problem.

    Can I use just the commands below and be able to open and save files from my removeable hard drive?

    snaps are packages outside the normal APT package management system. The names of programs and packages for those programs often match, but not always. For some APT packages, Canonical has decided to have the APT package setup and load the snap package instead. If you are happy with snaps, the security constraints, and auto-update (while retaining 3 package versions, that snaps do, great. OTOH, if you have a system with 16G of storage, 2G of RAM, and snaps are 500MB-1GB in size, then loading just a few programs will prevent any room for data on the storage.

    Snaps that can save data and open data should always be able to read and write to the HOME directory of the userid running the snap program. It is only when trying to read/write data mounted elsewhere that the removable-media snap connection could be useful. Sadly, not all snap packagers enable removable-media to be used and today, we can forget about accessing storage mounted outside the two (/mnt/ and /media/) directories by any snap, period. To me, that is a 32TB design flaw which impacts about 15 systems. Their choice of /mnt/ and /media/ as the only places shows extreme short-sightedness as well. The design for snaps originally was for an Ubuntu phone/tablet, so the constraints there made more sense.

    Also, you might find that the only packages provided for some of your favorite programs are snaps. Since 19.04, the chromium browser is not available as a normal APT package anymore. I still use 16.04 on my desktops, so chromium as a snap is an option, not the only option.

    So on a limited system, all data has to go onto USB devices because the snaps took all the main storage, but the project team for the snap package may not have allowed the removable-media option to be used. Wonder if they’d considered that? I have a few chromebooks, currently running ubuntu. I’m worried that 20.04 won’t be viable due to required use of snap packages.

    There are some great things about snaps too. Everything isn’t all bad, but we notice the bad things first.


  7. Re: Various thigs tried — Error opening directory ‘/media’: Permission denied

    I think I may have misunderstood how my system is set up.

    I input snap connect chromium:removable-media to test what that would do as I use Chromium very little (because of this problem).

    Nothing changed.

    Perhaps my system sees this drive as a second internal hard drive for this?

    It is a partition on my hard drive so Ubuntu and IOS can both see and edit files. I have had to treat it like a removable hard drive before so I might have got it wrong again this time.


  8. Re: Various thigs tried — Error opening directory ‘/media’: Permission denied

    What is my root folder? This is ambiguous. /root? /? or $HOME?

    Yeah, I always wondered about that phrase, as well as, root partition and root drive


  9. Re: Various thigs tried — Error opening directory ‘/media’: Permission denied

    To see what, where and how storage is mounted,

    Code:

    df -hT -x squashfs -x tmpfs -x devtmpfs

    any lines with «fuse» will be slower.

    To see how connected disks, not necessarily mounted, are laid out,

    Code:

    lsblk -o name,size,type,fstype,mountpoint

    chromium is a browser. It can’t open local files without specific options. They made this the default about 5 yrs ago. The command line I have to use to allow opening local files is:

    Code:

    chromium-browser --allow-file-access-from-files

    Google, the primary developers of chromium, really doesn’t like for their sheeple to access local files, local media. They consider it a security risk. They are not wrong.

    Include that chromium-browser is being packaged as a snap, with more constraints, and those added constraints can get in the way.


  10. Re: Various thigs tried — Error opening directory ‘/media’: Permission denied

    Somehow I missed this reply.

    Thanks for the help. It seems to have worked.

    Do you know of a good resource to learn more about how Linux works? Preferably something a little kid would like, because I get bored and go stare into space


Tags for this Thread

Bookmarks

Bookmarks


Posting Permissions

Many thanks.

Petermint wrote: ↑

Thu Nov 04, 2021 4:29 am


1/ Unmount using eject then remount. Sometimes this clears whatever is in Linux.

Ejected by «sudo eject sdb1»; «eject sdb1» w/o «sudo» returned «permission denied».
Directory created: «sudo mkdir /media/adata-hdd».
HDD mounted: «sudo mount /dev/sdb1 /media/adata-hdd/».
Then HDD was accessible by regular user but read only.

I then plugged out & plugged in the HDD USB cable.

Code: Select all

"Failed to open directory "user". Error opening directory '/media/user': Permission denied"

popped out automatically again. I didn’t continue — why the hell user could not access its own directory @ /media?
HDD was not mounted automatically @ /media/adata-hdd.

Couldn’t reboot at the moment due to some process pending.

ricardogroetaers wrote: ↑

Thu Nov 04, 2021 4:44 am


With said HDD plugged in and in your user account, post the output of the commands:
sudo parted -l
lsblk -f
id

parted -l

Code: Select all

Model: ATA ADATA SU800 (scsi)
Disk /dev/sda: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type      File system  Flags
 1      1049kB  538MB  537MB  primary   fat32        boot
 2      539MB   128GB  127GB  extended
 5      539MB   128GB  127GB  logical   ext4


Model: ADATA HD710 (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  1000GB  1000GB  primary  fat32        boot, lba

lsblk -f
12 loops related to snaps and:
sda
├─sda1 vfat 7F33-755D 511M 0% /boot/efi
├─sda2
└─sda5 ext4 f4507b31-e266-4c8c-9069-c8a73ffd7b39 35,3G 65% /
sdc
└─sdc1 vfat WARNING_1 15F2-3C5D /media/user/WARNING_1

id
uid=1002(true) gid=1002(true) groups=1002(true),4(adm),20(dialout),21(fax),24(cdrom),25(floppy),26(tape),27(sudo),30(dip),44(video),46(plugdev),115(lpadmin),135(sambashare),139(libvirt)

EDIT: so the HDD was mounted automatically @ /media/user. I could access and write to HDD using root shell («sudo -i» — I just didn’t know how to change directory in a different way than using root shell — «sudo cp» is not a command outside of bash, apparently). Anyway, the I would like to have HDD accessible for every user :)

Как мне дать дискорд доступ к моему жесткому диску?

Я пытаюсь загрузить изображение на дискету, которая находится на моем жестком диске. Дискорд дает мне эту ошибку: Error opening directory '/media': Permission denied при попытке перейти к изображению. Как я могу дать доступ к разногласиям?

задан
4 January 2018 в 03:15

поделиться

2 ответа

Вы можете попытаться изменить владельца или разрешения для каталога, который вызывает ошибку:

Для смены владельца:

chown -R new-owner:owner-group directory -> chown -R sam:sam media

Для изменения разрешений:

chmod -R 754 directory -> chmod -R 754 media

Если эти команды не работают, попробуйте выполнить приложение с помощью Судо, он должен иметь разрешения в этом режиме.

Надеюсь, это поможет, удачи!

ответ дан galoget
4 January 2018 в 03:15

поделиться

У меня была та же проблема при использовании Разногласий, установленных с помощью снимка (По умолчанию, каждое приложение, установленное из программного обеспечения Ubuntu, работает из снимка/, я думаю.) Решение было просто.

Откройте Ubuntu Software и ищите Разногласия. Если Вы видите, что это установило здесь, должно быть три опции: Выполненный, Удаление и Полномочия. Нажмите полномочия и удостоверьтесь, что чтение-запись на съемных носителях включено.

ответ дан NIMISHAN
7 December 2019 в 15:25

поделиться

Другие вопросы по тегам:

Похожие вопросы:

Forum rules
ImageThis forum is for Audacity on GNU/Linux.
Please state:

  • which version of Linux you are using,
  • the exact three-section version number of Audacity from Help menu > About Audacity,
  • whether you are running the Audacity Team AppImage, or installed your distribution’s release, PPA version, or compiled Audacity from source code.

Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade (see https://www.audacityteam.org/download/).
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.

dgn1

Posts: 4
Joined: Sun Nov 03, 2019 10:28 am
Operating System: OS X 10.9 Mavericks

Permission denied to open folder on second hard drive

I am using Ubuntu 18.04.3 LTS
I have just installed Audacity 2.3.2 from the Software Centre — I was originally using Audacity 2.3.0
I now cannot open a Project that was created using 2.3.0 that is stored on a second hard drive I have installed in my PC.
If I copy the Project to my primary hard drive it opens with no problem.
My Primary hard drive is a small SSD, so I want to store my media etc on the second which is a large standard hard drive.
The error message is cannot read the contents from «dave» (the home folder on the mounted drive) Permission denied.
Other apps such as GIMP work with the second drive without any permissions issues.
Any ideas?
Thanks



dgn1

Posts: 4
Joined: Sun Nov 03, 2019 10:28 am
Operating System: OS X 10.9 Mavericks

Re: Permission denied to open folder on second hard drive

Post

by dgn1 » Wed Nov 06, 2019 11:20 am

Hi Steve,

Sorry for delay in responding, this is my first post — should I have received an email notifying me of a response?

I have attached a screengrab of the Ubuntu Software Centre where I installed Audacity from — there are also entries for Audacity 2.3.0 and Audacity 2.2.1-1 .

Should I uninstall 2.3.2 and reinstall 2.2.1-1 ?

Thanks — Dave

Attachments
Audacity_Screenshot from 2019-11-06 11-11-30.png
Audacity_Screenshot from 2019-11-06 11-11-30.png (324.98 KiB) Viewed 3852 times


dgn1

Posts: 4
Joined: Sun Nov 03, 2019 10:28 am
Operating System: OS X 10.9 Mavericks

Re: Permission denied to open folder on second hard drive

Post

by dgn1 » Wed Nov 06, 2019 2:37 pm

Hi Steve,

I have uninstalled version 2.3.2 via the Ubuntu Software app and now installed 2.2.1-1 from the Ubuntu Software app and now can access files on the second hard drive.

Is 2.3.2 only for Ubuntu 19 ?

Thanks

Dave


steve

Site Admin
Posts: 86192
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Permission denied to open folder on second hard drive

Post

by steve » Wed Nov 06, 2019 7:45 pm

As far as I’m aware, the only «Audacity 2.3.2» version for Ubuntu, is a «snap» package and is known to have multiple problems.

Learn more about Nyquist programming at audionyq.com


shamantic

Posts: 2
Joined: Tue Jan 19, 2021 9:38 am
Operating System: Linux *buntu

Re: Permission denied to open folder on second hard drive

Post

by shamantic » Tue Jan 19, 2021 9:50 am

Hello,
unfortunately, with Ubuntu 20_04LTS, Audacity 2.4.2 from PPA, I have that issue again.

My drive is on /media/rae/UID
I cannot even browse to /media using Audacity’s open dialog (Error opening directory ‘/media’: Permission denied) while all other apps can access that data.
drwxr-xr-x 3 root root 4096 Dez 6 16:39 media/

Using a symlink to directly access data also fails with Audacity
lrwxrwxrwx 1 rae rae 58 Dez 20 16:54 work -> /media/rae/UID/data/work/

Any idea? Thanks
Klaus


dgn1

Posts: 4
Joined: Sun Nov 03, 2019 10:28 am
Operating System: OS X 10.9 Mavericks

Re: Permission denied to open folder on second hard drive

Post

by dgn1 » Tue Jan 19, 2021 10:35 am

Hi,
I recently upgrade my Ubuntu to Ubuntu 20.04.1 LTS

I installed Audacity 2.4.2 from the Software Centre and had the same problem — I then spotted a Permissions button on the Software Centre page for Audacity which allowed me to enable access for removable media — this then gave me read/write access to my 2nd Hard drive.

Hoe that helps
Dave


shamantic

Posts: 2
Joined: Tue Jan 19, 2021 9:38 am
Operating System: Linux *buntu

Re: Permission denied to open folder on second hard drive

Post

by shamantic » Tue Jan 19, 2021 10:45 am

Great thanks that’s it!
Klaus


Оффлайн
kuk71

При поытке сменить каталог сохранения в telegram-desktop на примамаунтченый диск получаю следующее сообщение

error opening directory permission denied

При этом ни у Firefox, ни у Chrome — таких прпорблем не возникает. каталог загрузки изменяется без затруднений.

Вот что выдает snap:

sudo snap connections telegram-desktop
Interface                Plug                                      Slot                             Notes
alsa                     telegram-desktop:alsa                     -                                -
audio-playback           telegram-desktop:audio-playback           :audio-playback                  -
audio-record             telegram-desktop:audio-record             :audio-record                    -
camera                   telegram-desktop:camera                   :camera                          -
content[gtk-3-themes]    telegram-desktop:gtk-3-themes             gtk-common-themes:gtk-3-themes   -
content[icon-themes]     telegram-desktop:icon-themes              gtk-common-themes:icon-themes    -
content[sound-themes]    telegram-desktop:sound-themes             gtk-common-themes:sound-themes   -
dbus                     -                                         telegram-desktop:tdesktop-dbus   -
desktop                  telegram-desktop:desktop                  :desktop                         -
desktop-legacy           telegram-desktop:desktop-legacy           :desktop-legacy                  -
gsettings                telegram-desktop:gsettings                :gsettings                       -
home                     telegram-desktop:home                     :home                            -
mpris                    -                                         telegram-desktop:tdesktop-mpris  -
network                  telegram-desktop:network                  :network                         -
network-manager-observe  telegram-desktop:network-manager-observe  :network-manager-observe         -
opengl                   telegram-desktop:opengl                   :opengl                          -
pulseaudio               telegram-desktop:pulseaudio               :pulseaudio                      -
removable-media          telegram-desktop:removable-media          :removable-media                 manual
unity7                   telegram-desktop:unity7                   :unity7                          -
wayland                  telegram-desktop:wayland                  :wayland                         -
x11                      telegram-desktop:x11                      :x11                             -

Вот что лежит в

# /etc/fstab: static file system information.
#

UUID=db443e39-76c9-41a4-b016-0124c7b74961 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdc1 during installation
UUID=6249-9D2C  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
UUID=0E9C9A219C9A037F /home/kuk/aWinDisk_G ntfs rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096 0 0

Доступа нет соответственно к /home/kuk/aWinDisk_G

Если есть идеи, подскажите как решить эту проблему.

« Последнее редактирование: 31 Октября 2021, 17:32:16 от Aleksandru »

Понравилась статья? Поделить с друзьями:
  • Error occurred invalid value in dnsrecord
  • Error occurred in starting fork check output in log
  • Error occurred in notifications webpart bad gateway росимущество
  • Error occurred during deleting the file
  • Error occurred in notifications webpart bad gateway росимущества