9

I just bought a new SATA disk and have formatted it 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!

4
  • 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, 2014 at 13:45
  • I thought lost+found should be hidden from writing from a non-root account.
    – DevRandom
    Aug 17, 2014 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. Aug 17, 2014 at 13:53
  • It doesn't matter. What would you do?
    – DevRandom
    Aug 17, 2014 at 13:55

3 Answers 3

5

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

su
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.

1
  • 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? Apr 29, 2021 at 10:15
2

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.

0

You can now use Gnome-Disk (sudo apt install gnome-disk) on Ubuntu or (sudo dnf install gnome-disk) if you are on fedora to take ownership and edit /etc/fstab via a GUI with no terminal commands.

Screenshot of Gnome-Disk on Desktop

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .