How to change drive ownership from root?

Questions about hardware,drivers and peripherals
Forum rules
Before you post please read how to get help
Post Reply
dirtyernie
Level 1
Level 1
Posts: 35
Joined: Wed Dec 25, 2013 5:55 pm

How to change drive ownership from root?

Post by dirtyernie »

How do I gain permission/ownership of a added on HD currently owned by root?

Just installed 500gb hard-drive as an external drive. root is owner and I want to take ownership to read and write to drive?
I know this can be done through the terminal but cannot find an example to get me there. Any help is appreciated. I know how to become rooot user but how to change the drive permissions?

User avatar
austin.texas
Level 20
Level 20
Posts: 12054
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: How to change drive ownership from root?

Post by austin.texas »

dirtyernie wrote:How do I gain permission/ownership of a added on HD currently owned by root?

Just installed 500gb hard-drive as an external drive. root is owner and I want to take ownership to read and write to drive?
I know this can be done through the terminal but cannot find an example to get me there. Any help is appreciated. I know how to become rooot user but how to change the drive permissions?
You don't want to become root user.
When logged in as the ordinary administrative user, take ownership of the mount point with the command:

Code: Select all

sudo chown $USER:$USER /media/<username>/<mountpoint>
Discover the actual <mountpoint> with the command:

Code: Select all

lsblk
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018

User avatar
Flemur
Level 17
Level 17
Posts: 7522
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to change drive ownership from root?

Post by Flemur »

Just installed 500gb hard-drive as an external drive. root is owner and I want to take ownership to read and write to drive?
Actually nobody owns the drive itself: directories on partitions are owned and have permissions.
Is it a new drive?
Is it partitioned?
What kind of partition(s)?
What makes you think root owns stuff?
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?

dirtyernie
Level 1
Level 1
Posts: 35
Joined: Wed Dec 25, 2013 5:55 pm

Re: How to change drive ownership from root?

Post by dirtyernie »

It is not a new drive. I formatted the drive in ext4 in Gparted.
When the drive is mounted it will not let me save files to it.
Right clicking drive under Properties/permissions it says drive is owned by root and is in Group root.
I don,t understand quite know to proceed from this point?

dirtyernie
Level 1
Level 1
Posts: 35
Joined: Wed Dec 25, 2013 5:55 pm

Re: How to change drive ownership from root?

Post by dirtyernie »

sblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
└─sda1 8:1 0 931.5G 0 part /media/greg541/3ac9aff5-7b2
sdb 8:16 0 465.8G 0 disk
└─sdb1 8:17 0 465.8G 0 part /media/greg541/985ab4a5-64b
sdc 8:32 0 931.5G 0 disk
├─sdc1 8:33 0 243M 0 part /boot
├─sdc2 8:34 0 1K 0 part
└─sdc5 8:37 0 931.3G 0 part
├─mint--vg-root (dm-0) 252:0 0 915.5G 0 lvm /
└─mint--vg-swap_1 (dm-1) 252:1 0 15.7G 0 lvm [SWAP]

User avatar
austin.texas
Level 20
Level 20
Posts: 12054
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: How to change drive ownership from root?

Post by austin.texas »

Just follow the instruction I gave you:

Code: Select all

sudo chown $USER:$USER /media/<username>/<mountpoint>
In this case that would be:

Code: Select all

sudo chown $USER:$USER /media/greg541/985ab4a5-64b
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018

dirtyernie
Level 1
Level 1
Posts: 35
Joined: Wed Dec 25, 2013 5:55 pm

Re: How to change drive ownership from root?

Post by dirtyernie »

Thanks that worked. :D

theraja57
Level 1
Level 1
Posts: 10
Joined: Mon Dec 17, 2018 6:19 pm

Re: How to change drive ownership from root?

Post by theraja57 »

Sorry about tagging on an old post but I'm having the same issue and I suspect there's maybe a syntax issue. I'm running Mint 19. No problem formatting the new HDD but getting current info on how to get r/w access has been frustrating. When I type the command line as austin.texas suggests the reply is chown: cannot access '/media/my username/f559-c14a. My mount point for sda1 (my new HDD partition) is shown as /mnt/f559c14a. I tried including the "mnt" part of the path in the command line in different locations but got the same message. I don't know if the method has been updated or my syntax is incorrect. Anyone know the current quick way to get this drive r/w? Thanks!

mediclaser
Level 4
Level 4
Posts: 380
Joined: Tue Mar 20, 2018 2:28 pm

Re: How to change drive ownership from root?

Post by mediclaser »

theraja57 wrote:
Sun Dec 30, 2018 9:19 am
Sorry about tagging on an old post but I'm having the same issue and I suspect there's maybe a syntax issue. I'm running Mint 19. No problem formatting the new HDD but getting current info on how to get r/w access has been frustrating. When I type the command line as austin.texas suggests the reply is chown: cannot access '/media/my username/f559-c14a. My mount point for sda1 (my new HDD partition) is shown as /mnt/f559c14a. I tried including the "mnt" part of the path in the command line in different locations but got the same message. I don't know if the method has been updated or my syntax is incorrect. Anyone know the current quick way to get this drive r/w? Thanks!
Please post what you get when you do lsblk in the terminal.
If you're looking for a greener Linux pasture, you won't find any that is greener than Linux Mint. ;)

User avatar
52ROSt
Level 4
Level 4
Posts: 425
Joined: Mon Apr 14, 2014 10:01 am

Re: How to change drive ownership from root?

Post by 52ROSt »

LM17.3 KDE

I found this old thread as it matches exactly my problem however I am doing something wrong and appreciate your help

I ran lsblk and get:

Code: Select all

rost@rost-X240:~ > lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   477G  0 disk 
├─sda1   8:1    0  29.8G  0 part /
├─sda2   8:2    0   7.7G  0 part [SWAP]
└─sda3   8:3    0   394G  0 part /home
sdb      8:16   0   1.8T  0 disk 
└─sdb1   8:17   0   1.8T  0 part 
sdc      8:32   0   1.8T  0 disk 
└─sdc1   8:33   0   1.8T  0 part 
sdd      8:48   0   1.8T  0 disk 
├─sdd1   8:49   0   1.2T  0 part /media/rost/HDD3_iodata
└─sdd2   8:50   0   667G  0 part /media/rost/680GBForImage
sr0     11:0    1  1024M  0 rom  
rost@rost-X240:~ > 
I need to change rights from root to me (rost, have admin rights) and used chown command in following form:

Code: Select all

rost@rost-X240:~ > sudo chown $rost:$rost /media/rost/680GBForImage
rost@rost-X240:~ > 
I as I was not sure about the "$" I also tried the command in this form:

Code: Select all

rost@rost-X240:~ > sudo chown rost:rost /media/rost/680GBForImage
rost@rost-X240:~ > 
Result is both cases no reaction at the terminal.

What am I doing wrong?

Thanks in advance for your help!

User avatar
52ROSt
Level 4
Level 4
Posts: 425
Joined: Mon Apr 14, 2014 10:01 am

Re: How to change drive ownership from root?

Post by 52ROSt »

LM17.3 KDE

I found this old thread as it matches exactly my problem however I am doing something wrong and appreciate your help

I ran

Code: Select all

lsblk
and got:

Code: Select all

rost@rost-X240:~ > lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   477G  0 disk 
├─sda1   8:1    0  29.8G  0 part /
├─sda2   8:2    0   7.7G  0 part [SWAP]
└─sda3   8:3    0   394G  0 part /home
sdb      8:16   0   1.8T  0 disk 
└─sdb1   8:17   0   1.8T  0 part 
sdc      8:32   0   1.8T  0 disk 
└─sdc1   8:33   0   1.8T  0 part 
sdd      8:48   0   1.8T  0 disk 
├─sdd1   8:49   0   1.2T  0 part /media/rost/HDD3_iodata
└─sdd2   8:50   0   667G  0 part /media/rost/680GBForImage
sr0     11:0    1  1024M  0 rom  
rost@rost-X240:~ > 
I need to change rights from root to me (=rost, have admin rights) and used
chown
command in following form:

Code: Select all

rost@rost-X240:~ > sudo chown $rost:$rost /media/rost/680GBForImage
rost@rost-X240:~ > 
As I was not sure about the "$" I also tried the command in this form:

Code: Select all

rost@rost-X240:~ > sudo chown rost:rost /media/rost/680GBForImage
rost@rost-X240:~ > 
Result is both cases no reaction at the terminal.

What am I doing wrong?

Thanks in advance for your help!

mediclaser
Level 4
Level 4
Posts: 380
Joined: Tue Mar 20, 2018 2:28 pm

Re: How to change drive ownership from root?

Post by mediclaser »

52ROSt, try this:

Code: Select all

sudo chown rost:rost /media/rost/680GBForImage -R
If you're looking for a greener Linux pasture, you won't find any that is greener than Linux Mint. ;)

User avatar
52ROSt
Level 4
Level 4
Posts: 425
Joined: Mon Apr 14, 2014 10:01 am

Re: How to change drive ownership from root? [SOLVED]

Post by 52ROSt »

Thanks for your help. I could change the ownership

I used first:

Code: Select all

rost@rost-X240:~ > sudo chown rost:rost /media/rost/680GBForImage -R
rost@rost-X240:~ >
As there was no reaction from the machine I also tried to add the "$" in front of name und group name

Code: Select all

rost@rost-X240:~ > sudo chown $rost:$rost /media/rost/680GBForImage -R
rost@rost-X240:~ > 
Again no reaction from the machine.

However I checked the partition directly and one of the commands I used changed the ownership. Thus if someone has the same problem, I recommend to try all commands I used and check after each command the ownership of the partition. This is necessary because I did not get any information at the terminal screen that the ownership was changed.

mediclaser
Level 4
Level 4
Posts: 380
Joined: Tue Mar 20, 2018 2:28 pm

Re: How to change drive ownership from root?

Post by mediclaser »

There are many terminal commands which don't display any message when the command is successful, and chown is one of those. By the way the -R option is to make sure the existing sub-directories (sub-folders) and their files are also affected by the ownership change.
If you're looking for a greener Linux pasture, you won't find any that is greener than Linux Mint. ;)

User avatar
52ROSt
Level 4
Level 4
Posts: 425
Joined: Mon Apr 14, 2014 10:01 am

Re: How to change drive ownership from root?

Post by 52ROSt »

Thanks for your additional information.

If learned something. The hard way! Hope it helps someone else.

Post Reply

Return to “Hardware Support”