LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why are all partitions owned by the root user? (https://www.linuxquestions.org/questions/linux-newbie-8/why-are-all-partitions-owned-by-the-root-user-4175469209/)

Altiris 07-10-2013 06:01 PM

Why are all partitions owned by the root user?
 
I am on Debian 7, I have two 500GB partitions. One partition is for the system itself and the other is for Backing up data. The problem I have is that after I type the root password to mount the partition it seems that the root user is the owner of the partition and I need to constantly use the terminal to store files.

The way I would fix this on CentOS is that I would format the parition and select something like "Own this partition". However GParted requries root access and then formats it as thchown -R user /path/to/dire root user. If there is a way to open up GParted and format the partition as the regular user that would be great.

---------------------------
(Add. Ifo)
I have tried chown -R user /media/PARTITIONNAME and I pretty much like the way it works, its a bit more secure meaning that I still need root access to mount the partition, I can access the files/folders that I made when I changed the chown to my user and then to make new folders I need to make them as root or chown the partition again. However this involves too much work and I was wondering if theres just a way to do it like I posted above.

Ser Olmy 07-10-2013 06:05 PM

Partitions don't have owners, but file systems and device nodes do.

You need permissions to access the device node (/dev/something) in order to mount the file system. Once mounted, you need the proper permissions on the mounted file system to read and write data.

You can have the system mount the partition(s) automatically by adding the proper entries to /etc/fstab.

Altiris 07-10-2013 06:27 PM

Wow I just found the Disk Utility program on Debian lolfail. I think I will leave it as is as its a bit more secure this way. THanks though, lock this.

selfprogrammed 07-12-2013 11:13 PM

A mountable device gets permissions based on who mounted it.

When a memory stick is mounted by root, it is available for read by all users, but they cannot write to it nor delete. For everyone to use the device, it is mounted R/W using mount flags.

Unmount that memory stick and have a user mount it, then it has read and write permission for that user.

See the mount command for more options.
See fstab for putting those options upon mounting directories.
I have a directory setup for each special device that I commonly use.
I then mount that directory, and through fstab it finds the device that should be mounted to it.

http://www.tuxfiles.org/linuxhelp/fstab.html

Example:
Make a directory /cdrom.
You could use the /Media/cdrom that is provided, but some other install programs use it, and also I do not like typing that long of a name to get to a root device.

Create a fstab line for the cdrom
/dev/cdrom /cdrom auto user,rw 0 0

>> mount /cdrom
This will find the entry with /cdrom and mount the device /dev/cdrom, with the filesystem "auto" (which is autodetect) using the flags "user,rw"
The cdrom will be mountable by users and will have R/W permissions.

Pay attention to the permissions of the directory used to mount a device.
It could restrict access if it is a restricted directory.


All times are GMT -5. The time now is 11:21 PM.