If you’ve attached an external hard drive for backing up your files, or created a new partition for storage, only to find you don’t have the permissions to use it, you’d be understandably frustrated. But it’s actually quite easy to remedy by simply running a command in the terminal in the form of:
sudo chown -R username:username /partition/mount-point
Note that the above isn’t the actual command you’ll be using, as you’ll need to replace each instance of username with your actual username, and also determine your mount-point, which is not the device name (eg: /dev/sdb1).
To find the mount-point, run mount in the terminal, and locate the line that corresponds to the drive or partition in question. If you have never named (or set the label for) it, it will probably look something like:
/dev/sdb1 on /media/bf9a2c45-491a-4778-9d76-47832fe38820
If you have set the label with something descriptive, it should like similar to:
/dev/sdb1 on /media/1Tb Pocket Drive
As you can see, your mount-point will look something like /media/bf9a2c45-491a-4778-9d76-47832fe38820 or /media/1Tb Pocket Drive, so all you need to do now is run a command like one of the following, replacing the relevant info with what is appropriate to you:
sudo chown -R billgates:billgates /media/bf9a2c45-491a-4778-9d76-47832fe38820
sudo chown -R billgates:billgates '/media/1Tb Pocket Drive'
Note that if your custom label contains spaces (e.g. 1Tb Pocket Drive) , you will need to enclose the entire mount-point path in single quotes, but won’t need them if it’s a single word or multiple words joined by hyphens or underscores.
That’s it – you should now be able to do whatever you want with the drive or partition in question, as you’re now the owner.
☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻
Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!
ption]
Not exactly my problem. I can easily see two physical drives that are on my system, however I can see but not access via any GUI application any of my external NAS devices.
The applications just do not see them even if I put in the location long hand et:
smb:// etc…
A specifc example:
I would like to use “locate” to find text strings within files on my on these back up storage NAS devices. (As well as use other GUI apps such as music playing.)
So to summarise how do get my gui applications to access show my NAS devices?
That’s the nicest expo of permissions; e.g. going deeper into finding mountpoint -I’ve so often been stopped by just a little bit of ambiguity – which is like just a little hole in a balloon! – I get the feeling that this is often purposeful i.e. anti-spoonfeed, but misplaced. Anyway, thanks, my brain grasps the permissions deal better now.
Hello,
Help!
Newbie here having problems trying to get ownership of my drive. This is what I see when I type the command “mount”. What command(s) do I need to enter to get ownership?
Tom
inspire@inspire-Inspiron-1720:~$ mount
/dev/sdb1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
gvfs-fuse-daemon on /home/inspire/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=inspire)
inspire@inspire-Inspiron-1720:~$
OK, I’m actually not sure what the question is. mount will simply show what’s mounted, and the tutorial you were at shows how to set drive permissions. I gather the ext4 partition /dev/sdb1 is your Ubuntu install (on the second physical drive), so you already have access to that, though you can only delete/edit stuff in your home folder without special permissions (in other words, the system owns all but the home folder, and tmp). If you’re trying to set ownership of a removable drive, then it needs to be plugged in while doing so. According to your output, you only have your system drive attached/mounted.
Thankyou for the help about my ext4 partition; I understand what is going on with the ext4 partition better now. I blew up my Ubuntu install and it has taken me a while to repair and get back here to thank you. Your website is the first I returned to so I could start learning some more. Thanks again for all your tips and tricks etc.
Thank you for the tutorial. I solved the problem and I am a bit ahead in Ubuntu. I think that solving the problems are the best way to study a new subject. I gone only through two lessons. Now I
can do a lot with the terminal command. Again, thanks a lot for providing such valuable lessons.
Wow, thank you very much not well versed with the CLI of linux, very well written step by step instructions. I have spent most my life learning Windows and often forget to use linux.
Except when I ran
mount
in the terminal it did not show my drive mount point at all(which was /sdb2) – As the GUI told me.
I just typed:
mount /dev/sdb2
And it told me it was already mounted then I got my point
Im using Ubuntu 12.10 with the latest updates. Perhaps a little bug in the mtab file.
All in all I got it working great many thanks.
– Stevo
Hi there,
I’m trying to add something to my usr/bin/ directory but my system keeps telling me permission denied. I assume this article is the article is what I’m looking for, but when I type “mount”, I don’t see a /sdb2 option. Is this because I don’t have an external drive? Everything I’m trying to do is on my internal hard drive, so do I have the wrong tutorial?
Stemming from this, when I use the “chown” command, I get the error “chown: cannot access ‘/media/username/Acer type fuseblk/’: No such file or directory. (I did replace “username” with mine, so no worries there.)
I guess my question boils down to: what am I doing wrong? -_-
Regards,
Allison
Oops, NO, actually this is for setting permissions for external drives or partitions other than what your system is on! Last thing you want to mess with is what the system owns on your Ubuntu partition, which is everything but your home folder. All you need to do is become ADMINISTRATOR (or “super user”) just for that current task. You can do this via CLI or GUI… these days you should be able to do this without the need for commands in the terminal so, for example, go into /usr via Nautilus (file manager), then right-click the sub-folder bin and choose “Open as administrator“, in which case you’ll be prompted for your password, and then a new “root” window will open in that folder… then you can simply drag and drop stuff into it, rename things, or create a new folder in it like you would do in your home folder. That should do the trick.
hi. I am running a live cd version of ubuntu 12.10 in an imac. I have a failing internal hard drive in that imac. I am trying to get ownership of that drive so that I can move the files that are on it to an external drive, and try to save whatever data I can. Any suggestions? I tried the above, but I got an error message for the chown -R command.
OK, if you’re using the Live CD for the chown command, then you can’t use your own username, since of course it doesn’t exist. The default username is ubuntu, and the password should be left blank (if not, then it should also be ubuntu). Alternatively, you could try sudo nautilus followed be the drive’s address to open Nautilus in superuser mode and just drag and drop as you please. To get that address, you can first open the partition in Nautilus, Ctrl+L to get the address bar up, then copy that path and paste it into the terminal. See how that goes.
I also tried to log in as root, but being that it’s a live cd version of ubuntu, I’m not sure my commands to do that were saved.
Thanks for your very usefull tutorial, however even following your instructions I am still having problems. Could it be the device is protected. How can I check?
You will need to fully outline the issue you’re having, as “problems” is very vague, unfortunately.
Thanks a ton Ubuntu Genius !! I was extremely worried about my official data loss after a messed up upgrade of 12.04 LTS… :)
Thanks for this tutorial, it solved my problem.
Thanks so much for this post, it helped me out. Great site, really has helped me out in a couple of situations!
I used your tutorial (thanks of course), but this is what i’m getting:
/dev/sdc1 on /media/nikolas/7C46-AC7B type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)
nikolas@nikolas-HP-Pavilion-dv7-Notebook-PC:~$ sudo chown -R nikolas:nikolas /media/7C46-AC7B
[sudo] password for nikolas:
chown: αδυναμία πρόσβασης του «/media/7C46-AC7B»: Δεν υπάρχει τέτοιο αρχείο ή κατάλογος
Greek: “can’t access” & “no such file or directory”.
Am I doing something wrong?
Originally I had user rights, but after I deleted some items from my usb flash drive, I don’t, and furthermore the trash bin won’t empty.
Thanx in advance (and sorry for my poor english).
OK, not sure what is going on here, since if your drive is mounted OK, that command should work (assuming you’ve entered the device name and mount point path correctly, of course). And I have to say it is very strange that all was fine until you deleted a few items from that drive! Normal file management tasks like deleting files simply shouldn’t have ANY effect on things like permissions/ownership. Run gksudo nautilus and navigate to the drive and see if you can delete files in its trash folder that way. In some cases it is necessary to hold down the SHIFT key so the deleted folders/files don’t reappear in the same Trash bin. Then also right-click an empty area of the root of that drive and choose Properties, and see if you can change permissions via the Permissions tab. See how that goes.
THANK YOU!! I had a dual boot setup, the windows 7 instal got corrupted anyway, and I Wanted that space. that was quick and easy.
Thank you for your clear description. Will try it later! Not quite on topic but I cannot find anything when searching. I like dolphin but caja is default. Dolphin mounts my partition as media/winlin but caja mounts as media/username/winlin. I obviously set up my mail when I had only used dolphin to the folders are linked to media/username/…mail. If caja opens a file before that the mail and various other links do not work as the path is now different ie now has the username inserted.
This is driving me nuts and I have no idea to to solve it. Any ideas? PS I would like to keep using dolphin for some things. Thank you
Hi, and sorry, but you’re better off asking a KDE user group, as I have no experience with Dolphin and its quirks. Only thing I could suggest is maybe look at creating a symlink from one to the other.
Thank you. Will try that.
I followed your tutorial and it was really good, thanks. I am still unable to access my drive though. Under the permission tabs my user still does not have any permissions.
mount shows: /dev/sdb1 on /media/chris/iusb type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)
Command Used: sudo chown -R chris:chris /dev/sdb1
Yet still my chris user has 0 permissions to the drive
Also tried : sudo chown -R chris:chris /media/chris/iusb
By “unable to access” do you mean you can’t access the device at all, or just can’t delete files off it, etc? Anyway, one thing I can tell you is that VFAT does not support Linux permissions, but there are ways around it (besides formatting the device to NTFS). Google “ubuntu permissions to vfat usb drive” and you will see plenty of others have come across this, and people have offered a wide variety of solutions, like vfat-specific mount commands, and editing fstab. You can then try which ones work for you. All the best.
I am using ubuntu 13.10…Had issues described above…I tried what was outlined in your article…. Did not work for me ….. The “mount” command did show the usb stick that I needed to change… When I entered the command to change …. The terminal window scrolled several lines “change of ownership denied…. But there was a couple folders on the usb stick from a windows system…The was plenty of space on the usb stick and it was not incrypted…. Any suggestions
Thanks Phil
I’m guessing the stick is formatted as VFAT, as most are. Unfortunately, VFAT does not support Linux permissions, but there are ways around it (besides formatting the device to NTFS). Google “ubuntu permissions to vfat usb drive” and you will see plenty of others have come across this, and people have offered a wide variety of solutions, like vfat-specific mount commands, and editing fstab. You can then try which ones work for you. All the best.
PS: The folders from your Windows system make no difference, as Ubuntu can handle any filesystem thrown at it. Half my portable drives are NTFS, and I have my actual Windows XP partition mounted and moving stuff between filesystems (EXT4 and NTFS) is not a problem. But as you’ve seen, VFAT is a bit of a bugger, as while you can move files about etc between Ubuntu and a USB stick, the permissions issue is another matter.
helppp i tried everything clearly but still its not working
everytime i try i comes just like this >>>> chown: changing ownership of `/media/VideoCD/autorun.inf’: Read-only file system
chown: changing ownership of `/media/VideoCD/ext/lot_x.vcd’: Read-only file system
chown: changing ownership of `/media/VideoCD/ext/psd_x.vcd’: Read-only file system
chown: changing ownership of `/media/VideoCD/ext’: Read-only file system
chown: changing ownership of `/media/VideoCD/mpegav/avseq01.dat’: Read-only file system
chown: changing ownership of `/media/VideoCD/mpegav’: Read-only file system
chown: changing ownership of `/media/VideoCD/segment/item0001.dat’: Read-only file system
chown: changing ownership of `/media/VideoCD/segment/item0002.dat’: Read-only file system
chown: changing ownership of `/media/VideoCD/segment’: Read-only file system
chown: changing ownership of `/media/VideoCD/vcd/entries.vcd’: Read-only file system
chown: changing ownership of `/media/VideoCD/vcd/info.vcd’: Read-only file system
chown: changing ownership of `/media/VideoCD/vcd/lot.vcd’: Read-only file system
chown: changing ownership of `/media/VideoCD/vcd/psd.vcd’: Read-only file system
chown: changing ownership of `/media/VideoCD/vcd’: Read-only file system
chown: changing ownership of `/media/VideoCD/vcd_play.exe’: Read-only file system
chown: changing ownership of `/media/VideoCD’: Read-only file system
OK, ignoring the fact your mount point is called “VideoCD” (since you can’t actually write to an optical disc that’s been finalised), the problem seems to be that it is mounted only as RO (read-only) – you need to mount it as RW (read/write). Try:
mount -o rw,remount /media/VideoCD (you’ll probably need to start that off with sudo)
Of course, if it is in fact a finalised disc, then that’s your answer – you can’t do anything to it, since it is understandably mounted only as RO.
this is total bullshit are we still stuck in the dark ages where we type commands I really want to like Linux I really do when Linux quits the command thing I mean this is 2013 lets let Linux start the right and left click thing.
When I wrote partition it said it was not a file so I got rid of it only to have it say access denied
[…] is the link to this website: https://ubuntugenius.wordpress.com/2012/06/07/ubuntu-hardware-permissions-how-to-set-ownership-of-dri… It used to work but it used to say I do not have permission even though I am in […]
hi admin thanks for the effort your putting in assisting us …i followed your guide but still cant add files to my partition disc please help. the following are the results i get
victor@victor-RV411-RV511-E3511-S3511:~$ sudo chown -R victor:victor/dev/sda3 on ‘/media/victor/BACK UP ONE ‘
[sudo] password for victor:
chown: invalid group: ‘victor:victor/dev/sda3’
victor@victor-RV411-RV511-E3511-S3511:~$ ^C
victor@victor-RV411-RV511-E3511-S3511:~$
please note that my partition is named BACK UP ONE and my user name is victor after i run mount the following results appeared on my terminal
victor@victor-RV411-RV511-E3511-S3511:~$ mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=victor)
/dev/sr0 on /media/victor/MyDisc type iso9660 (ro,nosuid,nodev,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)
/dev/sda3 on /media/victor/BACK UP ONE type ext2 (rw,nosuid,nodev,uhelper=udisks2)
/dev/sda4 on /media/victor/BACK UP TWO type ext2 (rw,nosuid,nodev,uhelper=udisks2)
victor@victor-RV411-RV511-E3511-S3511:~$
please if possible extract for me the command so that i would only copy paste it to my terminal
OK, if all that is copied and pasted straight from the terminal, I can see some problems with your initial command: sudo chown -R victor:victor/dev/sda3 on ‘/media/victor/BACK UP ONE ‘
First, there is no space after victor:victor – you’ve put it as victor:victor/dev/sda3, which is bound to cause problems. Secondly, instead of putting your mount point – ‘/media/victor/BACK UP ONE’ – you’ve put /dev/sda3 on ‘/media/victor/BACK UP ONE ‘ – that /dev/sda3 on (and space after it) is not needed, and can only result in failure. And lastly, notice the space at the end of the mount point? That of course will also end in failure – the computer won’t correct typos or remove characters you accidentally entered, so you need to be extremely careful you’ve entered something that isn’t gibberish to the computer. ‘/media/victor/BACK UP ONE ‘ instead of ‘/media/victor/BACK UP ONE’ would have been enough to make this fail, as you have a partition with the former name and not the latter with that extra space.
Thanks admin though i could not still make it despite taking note of your earlier instructions. However, i decided to format the partitions to NTFS file systems and now i can add and delete files from them though i don’t know the consequences with regards to this. Please can you advice if at all its safe to keep my document in this partitions when they are in this file format system and if at all i stand a chance of loosing any of them or not being able to perform certain actions as a result of this file format system.
Please note that when i look at the disc permission this is what i get ” The permission of BACH UP ONE could not be determined ” though if i open the disc and check the properties from agen by righ clicking and moving down to select properties i get the details that i am the owner and that i have the permission to access and delete files.
Please advise.
Hi. While NTFS is vastly inferior to *journaling* filesystems like EXT3, and especially so compared to EXT4, it is safe to use in Linux. In fact, when I first installed Ubuntu in 2006, the NTFS support was already fantastic, and errors transferring files between NTFS and EXT3 were almost unheard of. The only reason I would personally format a drive to NTFS is if I wanted to share files with friends on the Windows PCs. For your own backups, etc, I really would recommend the next drive you get to set up as EXT4, and just nut through the permissions issue (hopefully you don’t have to worry too much about this in the future – most people don’t have as much trouble as you did). All you’d then need to do is reclaim the reserved space via: https://ubuntugenius.wordpress.com/2012/01/10/how-to-reclaim-reserved-space-on-ext4-partitions-external-hard-drives-in-ubuntu/.
Also, when the command-line method fails, try opening the drive in a Nautilus window as root (https://ubuntugenius.wordpress.com/2010/05/22/open-files-folders-with-administrative-privileges-in-nautilus-ubuntus-file-manager/), and you should just be able to right-click > Properties, and change permissions that way.
As for your last question, if everything seems to be working OK, just ignore it, especially since you can view the info via Properties another way. Hope all that helps. Cheers.
Thank you! Worked perfectly for me!
Thank you !!!!!!!
I’m considering setting up donate buttons on my website, kind of like how you have this one setup here, and was wondering if its a lucrative ($) business decision?
Well, not really, as while I had a few readers suggest I should add a donate button, as they would have gladly donated, in the 2 or 3 months since I did, I’ve yet to receive a single donation. Still, it’s done, and just took some time, and my PayPal account being suspended for a few days while they did a background check (to prevent money-laundering, apparently) – that coincided with a few quiet days on eBay, so I didn’t have to explain anything to customers who were trying to pay. Cheers
Ok Genius. I read the rest and it’s not addressed. :)
I’m running crouton (minimal ubuntu) on a chromebook.
I installed software to legally watch my dvd movies and an external dvd
I can play movies but I have to do chmod 777 /dev/sr0 every time.
I tried following the directions here and changing ownership of th mount point.
sudo chown -R julia:julia /var/hosts/media/removable/DRIVE
I tried it first without the movie name “DRIVE” (confusing name in this context)
the error I get is:
chown cannot access ‘/var…/DRIVE’ no such file or directory
or
chown cannot access ‘/var…/removable’ no such file or directory
If I remove the DVD from the drive, the external DVD drive no longer shows up in mount list
also and maybe important, fstab is empty.
I think things are getting mounted by some other mechanism.
can you help me?
I did this
sudo chown -R fiowak:fiowak /media/fiowak/3c2cb145-3dec-4101-9dc0-b7d40c351ed6
But it said
changing ownership of ‘/media/fiowak/3c2cb145-3dec-4101-9dc0-b7d40c351ed6/ldlinux.sys’: Operation not permitted
What to do?
OK, I’m not too versed in ldlinux.sys, but the file has the immutable attribute set, which prevents it from being deleted or overwritten. ldlinux.sys is the bootloader file used in SYSLINUX and ISOLINUX (used for booting Linux off of FAT32 and ISO9660 filesystems, respectively). It is loaded into memory by the BIOS on bootup. The loader then parses the configuration file (syslinux.cfg or isolinux.cfg) to know which kernel to launch, along with parameters to be passed to it. So, if this is just a backup drive, not a boot drive with OS (though it seems it was at one point), then I guess it would be safe to delete the file. I’d look for more info on that, or if worse comes to worse wipe it with the Partition Editor.
Thanks a lot.. it worked..!
[…] thanks goes to Ozzy Frank and his blog for supplying the correct […]
[…] and for finding out the mount point, from the following link- https://ubuntugenius.wordpress.com/2012/06/07/ubuntu-hardware-permissions-how-to-set-ownership-of-dri… […]
[…] and for finding out the mount point, from https://ubuntugenius.wordpress.com/2012/06/07/ubuntu-hardware-permissions-how-to-set-ownership-of-dri… […]
ahhhh was unaware of needing to specify the /media/ location of the Ext drive as opposed to the /dev/sdb name. thanks!
Thanks for this terrific tutorial. I was going out of my mind with a Linux Mint 19 install that I had cloned from another computer. I had already given my data partitions labels and root was the owner. I couldn’t copy or create a folder in my own partitions. Your tutorial is the only one that mentioned that I needed to enclose the entire mount path in single quotes.
Glad I could help! Yes, I try to be as comprehensive as possible – there’s nothing worse than only having 3/4 of the information you need. Cheers.