Changing Raid 1array permissions from Root to User

JaceSchin

Member
Joined
Apr 26, 2020
Messages
32
Reaction score
5
Credits
207
Hey,

So I just set up a raid 1 array using mdadm with two 480 Kingston SSD's (sdb1 and sdc1) with the name md1 (/dev/md1) ina an ext4 filesystem. I created the array just fine but where I am in trouble is with the permissions. I can't save any files to it through the GUI because the owner of the array is Root. Attached are some pictures of the details and permissions of the array, I also attached pictures of a drive that has the correct permissions (which is not in an array). So my goal is to change the owner of the array from root to user. Any help on this would be great!

I had a similar problem a few months ago with all of the extra drives in my system. The same command that helped me last time isn't working this time.

Linux experience:
I am a pretty new user to Linux having only switched over a few months ago. Really enjoying getting to know it. I am in the middle of taking "Introduction to LInux" course by the Linux Foundation on edX.

System:
Distro - OpenSuse Tumbleweed
CPU - Intel i5 4670k Haswell 22nm
CPU Cooler - Bequiet! Dark Rock 3
Motherboard - Asus Z87-Pro
Ram - G.Skill Sniper DDR3 4x32gb 1866 9-10-9-28
GPU - Asus RX570 4gb
PSU - Corsair HX650
Boot disk - Samsung Evo 500gb SSD sata
Case - Corsiar C70
Case fans - x3 Bequiet! Silent Wings 2 120mm, x1 Noctua 140mm
 

Attachments

  • Raid Details.png
    Raid Details.png
    43.9 KB · Views: 456
  • Raid Permissions.png
    Raid Permissions.png
    23.2 KB · Views: 458
  • Example Drive Detail.png
    Example Drive Detail.png
    44 KB · Views: 443
  • Example Drive Permissions.png
    Example Drive Permissions.png
    26.4 KB · Views: 447
  • Array Detail.png
    Array Detail.png
    68.9 KB · Views: 405


@JaceSchin -- are you aware of how to become Root? Do this first
Code:
sudo passwd root
So my goal is to change the owner of the array from root to user. Any help on this would be great!
Code:
cd / && chown -R username:username /directory
NOT a good idea!
 
  • Like
Reactions: Rob
You need to change the owner and / or permissions of the mount.

Changing the owner of a mount to a particular user is definitely not a good idea for shared computers. It is better to assign read and write permissions to a group to which athe users belong.

For example, if users is the group to which all the regular users belong, something like this may work better:

Bash:
chown root:users /path/to/the/mount
chmod g+rw /path/to/the/mount

Also, don’t do -R unless you want to modify all the files inside (the first one would make the root user to own all the files in the array which is something you don’t want to). Check your distribution’s docs to find the right group. If you already have files inside, proceed with caution and on a directory by directory basis.
 
  • Like
Reactions: Rob
Hey gvisoc,

Thanks for the response!

I tried using chown root:users /dev/md1I didn't get an output so I thought it would work but the group is still set to root. I also tried sudo chmod g+rw /dev/md1and I got an output "Operation not permitted" so then I logged in as root and typed chmod g+rw /dev/md1and didn't get an output in the terminal but that one didn't change the group to users.

Does /dev/md1 make sense as the mount point? I don't know if understand the concept of mount points. Coming from Mac and Windows its a new concept for me.
 
@JaceSchin -- are you aware of how to become Root? Do this first
Code:
sudo passwd root

Code:
cd / && chown -R username:username /directory
NOT a good idea!
Hey sp331yi,

Yeah, I do know the basic concept of sudo and su. I try to stay away from using su as much as possible, kinda got me in trouble the last time I was having root permission issues, haha. But according to gvisoc I should just change the group to users. Do you know what command I should use?

Thanks for your response!
 
Hey gvisoc,

Thanks for the response!

I tried using chown root:users /dev/md1I didn't get an output so I thought it would work but the group is still set to root. I also tried sudo chmod g+rw /dev/md1and I got an output "Operation not permitted" so then I logged in as root and typed chmod g+rw /dev/md1and didn't get an output in the terminal but that one didn't change the group to users.

Does /dev/md1 make sense as the mount point? I don't know if understand the concept of mount points. Coming from Mac and Windows its a new concept for me.
Hi

you’re trying to change ownership and permissions over the device (/dev/...). You have to do that over the mount point of that device, which may depend on your installation choices: they can be a subdirectory under /mnt, or /home/,... Check where the array is mounted on by executing mount without parameters. You should see a rather large output with your line in between, like:
Code:
...
/dev/md1 on /path/to/mount type...
...

the mount directory (/path/to/mount) will be there. Then you can retry the commands over it.

Note: when the commands are successful they output nothing!, but the success over the device will be unfruitful as the mounting options will override the chown and chmod over the device.
 
  • Like
Reactions: Rob
So I used the command below and it worked to change the group to users:
sudo chown root:users /run/media/jace/8b150391-28c6-4555-9133-4be413568719

Then this command changed the permissions to edit and delete files:
sudo chmod g+rw /run/media/jace/8b150391-28c6-4555-9133-4be413568719

Thank you for your help getting that fixed!!
 
@gvisoc -- buen trabajo!

Dame un Aguila!
 
When in Madrid, it was the beer I drank, when i wasn't drinking the good, inexpensive vino rojo. Had to give them both up, however. A personal thing.
Enjoy your Weber!
 

Staff online


Top