Score:0

Permission denied on /media

is flag

I'm using Ubuntu 22.04 on Dell Alienware R13 desktop (multiboot with Windows 10).

My problem is that permissions are denied on /media directory.

I don't know what caused this problem. As I recall, I was trying to upgrade the Nvidia driver, and suddenly the system didn't boot up and fell to busybox (initramfs). And I found that the SATA setting in BIOS was somehow set to "RAID on" so I changed it to "AHCI/NVMe". Now it boots normally but I found the network setting is gone.

So I needed to install some drivers using external (USB) devices. But when I connect any external device, it refuses to mount saying that it couldn't create a directory at /media/. And when I tried to write anything on /media, the permission was denied.

When I try to mount it from 'Disks' utility, I got this error message:

(X) Error mounting filesystem

Error creating directory '/media/alien': Permission denied (udisks-error-quark, 0)

The directory is shown as:

alien@R13:~$ ls -l / | grep media
alien@R13:~$ drwxr-xr-x  2 root root  0 Aug 3  13:10 media

I cannot create anything at /media/:

alien@R13:~$ touch /media/test    
touch: cannot touch '/media/test': Permission denied

The problem is the same if I use "sudo" or "sudo su".

I chmod'ed /media to 777 but no use. And it turns back to 755 after a reboot.

I chown'ed /media to my user account (alien) from root, and the permission problem wasn't solve either.

I'm trying to find the solution since yesterday with no luck. Thanks!

nobody avatar
gh flag
`lsattr /media`please and `mount` also.
Score:0
rs flag

I'm not sure if /media is part of your system, or if it is your usb drive. If media already existed and then mounted it to your usb, then you can umount the drive, and mount it again specifying a user/group: sudo mount -o uid=<user_id>,gid=<group_id> /dev/sd<some number> /directory/to/mount

id -u <username>
(gets user id)
id -g <groupname)
(gets group id)

To get the "Some number", you can use lsblk. It will list all the drives currently connected, and you can find your usb stick there, most likely by looking at the size.

My 32gb stick looks like this:

sdb      8:16   1  28.6G  0 disk
└─sdb1   8:17   1  28.6G  0 part

So I would use sdb1 in the command.

John Oh avatar
is flag
My Linux Bible book says that /media provides a standard location for automounting devices (removable media in particular. So I think it's a system directory and my usb drive should appear under /media.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.