I just bought a new SATA disk that I've now formated into ext4 using gparted. When I ran Gparted, I ran it as root. Now, I can't write files to the drive because I'm not the owner of the drive.

enter image description here

The drive has a folder called lost+found . I'm primary going to store virtual machines on the drive.

Now my question is the following; What is the best way (most secure?) to make me the owner of the drive without "destroying" the permissions on the drive (I'm thinking of the lost+found folder).

Thanks in advance!

  • I added an answer but I'm not quite sure what you meant by "without destroying the permissions on the drive". – duxk.gh Aug 17 '14 at 13:45
  • I thought lost+found should be hidden from writing from a non-root account. – DevRandom Aug 17 '14 at 13:49
  • Do you want to mount the whole drive as yours or do you just want to be able to put files on it? You could create a directory and set the ownership to you, then you could put files inside that directory. – Andrea Lazzarotto Aug 17 '14 at 13:53
  • It doesn't matter. What would you do? – DevRandom Aug 17 '14 at 13:55

If you have root access then fire up your terminal and write

Password: (enter your root password here.)

Now mount your HDD (if not already mounted). And type

chown -R "username_youwant" path_to_folder/folder_name

And now you're done!

It is generally a good practice to mount your HDDs in the /media or /mnt directory.

  • This doesn't work for me (Ubuntu 18). Does it make a difference if I'm using sudo -i instead of su? Is this relevant? Because su won't accept a blank password – and I never set any root password. Does it need to be the mountpoint or can I change ownership of any subdir? – WoodrowShigeru Apr 29 at 10:15

You go do this all through terminal, but I personally find it easiest to run my file manager (I use nemo but nautilus is default) as root and to change permissions graphically.

So open up a terminal and run gksudo nautilus.

Open the properties like you did in the screenshot. Since you're root now, you will be able to change it to your user.

This, however, is probably a better place to find a well explained answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.