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!

DevRandom
  • 404
  • 2
  • 4
  • 12

3 Answers3

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.

TheOdd
  • 3,012
  • 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 '21 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.

duxk.gh
  • 1,458
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

TommyPeanuts
  • 1,079
GBJ
  • 9