[SOLVED] How to give file permission to a new partition
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,363
Rep:
... Another suggestion, I mount things under my home directory (usually under /home/rick/mnt/) in order to avoid ownership and permission issues and to ensure I retain full control over the mounts.
I then used the GUI to open up the partition and a dialog box asked for root password
Exactly how did you 'open up the partition'? I don't use Debian but, but I believe the standard methods for opening a file manager on xfce would be either: gksu thunar or pkexec thunar from a terminal. You should be prompted for your root password and that opens the thunar file manager. If you close this instance of thunar and open another, the second instance will be an ordinary user.
Given the ls -l output you posted, the simplest way to enable yourself access to the partition as a normal user is to use the chown command suggested above.
- You created the partition with root, so it is owned by root (confirmed by your ls -l output as mentioned in my previous post)
- You currently have no fstab entry specifying the appropriate options, so when you use the GUI tool in xfce to access the partition, you are asked for the root password. This is as expected.
- The GUI then dutifully "opens" the partition. What has actually happened here is that you have mounted the partition as root.
- When you try to actually write to the now root-mounted partition with the xfce GUI, you are attempting to do that under your regular user id session (assuming you're not logged in as root). Again, that you are not permitted to do this is normal.
Yes, it would seem although the GUI allows mounting the partition as root, it flips back to 'user' when doing other actions (like copying files).
Quote:
There are also options that can be used when manually mounting a partition that will give certain or all users rwx permissions, but in your situation, I don't see that as the most efficient solution.
Yes, I think simply using the command line is better for me as the partition wont be used often.
Exactly how did you 'open up the partition'? I don't use Debian but, but I believe the standard methods for opening a file manager on xfce would be either: gksu thunar or pkexec thunar from a terminal. You should be prompted for your root password and that opens the thunar file manager.
It's a simple case of double-clicking on a folder icon on the xfce desktop and it opens up the thunar file manager. You don't need to open a terminal.
When I click on the new partition icon on the file manager, a box opens asking for root password which then allows access to the partition.
But this is read-only when using the desktop (GUI).
Quote:
If you close this instance of thunar and open another, the second instance will be an ordinary user.
This is very interesting. When using the GUI file manager to initially mount the partition, root password is needed.
But it's then necessary to open a second instance of the file manager to complete the copy action.
If the second instance of the file manager is 'user' then the copy action may not work because both file manager instances aren't root.
Quote:
Given the ls -l output you posted, the simplest way to enable yourself access to the partition as a normal user is to use the chown command suggested above.
Let's say I mount the partition called 'movies' using the GUI and it mounts by default to /media/movies.
If I then use the command:
Code:
chown -R user:user /media/movies
will this give permanent user ownership of the partition?
The reason I say this is because it doesn't require creating a separate mount point or an entry in etc/fstab.
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,363
Rep:
Quote:
Originally Posted by trumpforprez
... Let's say I mount the partition called 'movies' using the GUI and it mounts by default to /media/movies.
If I then use the command:
Code:
chown -R user:user /media/movies
will this give permanent user ownership of the partition?
The reason I say this is because it doesn't require creating a separate mount point or an entry in etc/fstab ....
... I believe the answer to this is no. The /media folder, as previously explained, is usually used to mount removeable devices (ex. USB) and the mount points are transitory. Your best bet is the following in my opinion:
- Add a line in your fstab to mount the partition to a mount point (directory) that you have previously created under your /home/<your_user_id>/ directory (so your user id is permanent owner). Specify the option noauto so that the partition will only mount on demand (for instance when you click on it in Thunar).
- If you absolutely do not want to add anything to your fstab, I would still advise manually mounting to a mount point previously, and permanently created in your user id home directory, to avoid permission problems. Also, mount using the command line as opposed to the terminal so that you can specify this mount point. I strongly recommend the fstab option though, given that the disk is permanently attached to the system.
When I click on the new partition icon on the file manager, a box opens asking for root password which then allows access to the partition.
But this is read-only when using the desktop (GUI).
I don't know why you would not have write access if you need to enter the root password but then I don't use Debian. I don't see that behavior on the Linux systems I use.
Quote:
This is very interesting. When using the GUI file manager to initially mount the partition, root password is needed.
But it's then necessary to open a second instance of the file manager to complete the copy action.
If the second instance of the file manager is 'user' then the copy action may not work because both file manager instances aren't root.
If you use the options I mentioned in my earlier post to open the file manager, you should have root access to write to any partition.
Simpler to create a mount point in /mnt directory and manually mount since you won't want it mounted at all times. Either that or an fstab entry with the noauto option.
- Add a line in your fstab to mount the partition to a mount point (directory) that you have previously created under your /home/<your_user_id>/ directory (so your user id is permanent owner). Specify the option noauto so that the partition will only mount on demand (for instance when you click on it in Thunar).
I have done this. However, on a previous member's recommendation, I put the mount point for the new partition in root.
This is because I wanted to manually mount the partition as root. I then added 'noauto' and 'user' as options for the partition in /etc/fstab.
Thankfully, after I've mounted the partition as root, I then have rwx permission as 'user'.
(Where /mnt/video could be /media/video, if you prefer).
Thank you, I wanted to know the correct code to put in /etc/fstab. I initially left out the digits for 'dump' and 'pass'.
This is how it eventually appears:
Code:
# This is the movies partition
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=f354c845-f1dc-xxxxx-c2318023b4be /moviepartn ext4 noauto, user 0 0
The bit with 'rw,errors=remount-ro' are the options that appear for the partition of the OS. I don't know what it means so I left it out.
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Rep:
Quote:
Originally Posted by trumpforprez
The bit with 'rw,errors=remount-ro' are the options that appear for the partition of the OS. I don't know what it means so I left it out.
These options mean basically that, if there is an error mounting the partition, it will be mounted as read-only. This could be caused by (but not limited to) a damaged file system/corrupted file system, etc.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.