Changing ownership of folder on mounted drive

Monte1022

New Member
Joined
Jun 24, 2020
Messages
26
Reaction score
0
Credits
245
Hi everyone. It's me again.

I have a mounted 6TB drive (you may remember from another thread).

Well, I created a folder in it that I want to share. I'm logged into my ubuntu box (the latest distro) as myself, and when I try to share, I get a message that I'm not allowed to because of an ownership permission (the folder is owned by "root").

So I tried to do a chown on the folder, but it still shows as being owned by "root" instead of by me.

So let's say the drive is mounted at /mnt/sixtb, and the share is called "my_share". What would the correct command be in order to actually share out this folder?
 


This always works for me:
Code:
$ sudo chown -Rv youruser:youruser /path/to/dir/or/mount/point/of/a/storage
Changing permissions through the GUI is glitchy and works only temporarily.
 
This always works for me:
Code:
$ sudo chown -Rv youruser:youruser /path/to/dir/or/mount/point/of/a/storage
Changing permissions through the GUI is glitchy and works only temporarily.
Ok, I just ran that command. I get a message that ownership changed, but it doesn't appear that's actually the case, because running ls -l still shows the owner as root.
 
Then there's something else preventing the change but IDK what it is. I recently converted all of my storages to ext4 (they were NTFS before that) and when I tried to create anything on either of them, I saw an ownership message. Using the command above fixed the problem.
Have you tried rebooting the computer AFTER running the command and see what 'ls -l' says when it boots back up?
Also, can you show us the contents of your fstab?
 
Ok, I just ran that command. I get a message that ownership changed, but it doesn't appear that's actually the case, because running ls -l still shows the owner as root.
Can you show the output of ls -l and the error?
 
Can you show the output of ls -l and the error?
The output of ls is as follows:

total 0
drwxrwxrwx 1 root root 0 Jul 15 07:56 sixtb_share

Where sixtb_share is the name of a folder I created.

The error I get when I try to share the folder is:

'net usershare' returned error 255: net ushare add:
cannot share path /mnt/ntfs_6tb/sixtb_share as we are
restricted to only sharing directories we own.
Ask the administrator to add the line "usershare owner only=false"
to the [global] section of the smb.conf to allow this

And for @rado84, the relevant part of the fstab looks like this:

UUID=<uuid> /mnt/ntfs_6tb ntfs defaults, x-gvfs-show 0 2
 
@Monte1022 , I suggest you use the ntfs-3g driver because the new ntfs driver is still far from perfect. Also, you need to setup rights for the ntfs partition, otherwise changing ownership won't work. Here's an example of what my fstab USED TO BE when I still had ntfs partitions:
Code:
UUID="9672796A7279504B" /media/4000GB ntfs-3g defaults,relatime,no_prefetch_block_bitmaps,auto,uid=1000,gid=1000,umask=000 0 0
You can ignore "no prefetch block bitmaps", that was just a precaution for a specific thing in my case. But for your case you need both GID (group ID) and UID (user ID). When these two are not specified, by default the ownership is distributed to root.

Basically the part you need to put in your fstab is this:

Code:
defaults,relatime,auto,uid=1000,gid=1000,umask=000 0 0
 
@Monte1022 , I suggest you use the ntfs-3g driver because the new ntfs driver is still far from perfect. Also, you need to setup rights for the ntfs partition, otherwise changing ownership won't work. Here's an example of what my fstab USED TO BE when I still had ntfs partitions:
Code:
UUID="9672796A7279504B" /media/4000GB ntfs-3g defaults,relatime,no_prefetch_block_bitmaps,auto,uid=1000,gid=1000,umask=000 0 0
You can ignore "no prefetch block bitmaps", that was just a precaution for a specific thing in my case. But for your case you need both GID (group ID) and UID (user ID). When these two are not specified, by default the ownership is distributed to root.

Basically the part you need to put in your fstab is this:

Code:
defaults,relatime,auto,uid=1000,gid=1000,umask=000 0 0
So do I need to reformat the drive as NTFS 3G? Or just add that parameter to the fstab? It's a "new" drive in that it doesn't have anything on it except this one folder I created.
 
I suspect the share permission error is due to the fact your drive is NTFS, as it looks like you gave the mount directory full permissions to all users. Maybe it's a case that net share doesn't understand how to handle NTFS.

So do I need to reformat the drive as NTFS 3G? Or just add that parameter to the fstab? It's a "new" drive in that it doesn't have anything on it except this one folder I created.
ntfs-3g is a mature ntfs driver for Linux that allows reading of NTFS filesystems. You wouldn't reformat as "NTFS-3G"
 
So do I need to reformat the drive as NTFS 3G? Or just add that parameter to the fstab? It's a "new" drive in that it doesn't have anything on it except this one folder I created.
No need to. Simply replace "ntfs" with "ntfs-3g" (and you may need to install it, if you don't have it already in the system), then replace everything after "ntfs-3g" with the string I just gave you - the string that begins with "defaults".
 
No need to. Simply replace "ntfs" with "ntfs-3g" (and you may need to install it, if you don't have it already in the system), then replace everything after "ntfs-3g" with the string I just gave you - the string that begins with "defaults".
Ok...now it looks like this:

UUID=<uuid> /mnt/ntfs_6tb ntfs-3g defaults, relatime, auto, uid=1000, gid=1000, umask=000, x-gvfs-show 0 2

I've obviously done something wrong, because now the drive isn't there at all after a restart.
 
Ok...now it looks like this:

UUID=<uuid> /mnt/ntfs_6tb ntfs-3g defaults, relatime, auto, uid=1000, gid=1000, umask=000, x-gvfs-show 0 2

I've obviously done something wrong, because now the drive isn't there at all after a restart.
I can think of only 2 reasons it's not there:
1. You don't have ntfs-3g driver installed, only ntfs and both are different. You're telling the system to load a partition using a driver that doesn't exist in the system, so you can't expect it to be loaded and mounted. IDK how things are with ubuntu, you'll probably have to look for a repo for ntfs-3g and install it. Then you can reboot again to see if the drive comes online.
2. When you mount a partition in anything other than /media, it doesn't show up in the file manager. It will show up as a native directory. I can't be sure whether it's the same with NTFS bc I've never tried that but based on what you describe, it sounds that way.
If you want it permanently visible in the file manager like this:

2Flmn8L.png


then you'll have to mount it in /media - /media/NTFS_6TB (for example).
"Media" is for USB sticks and when you mount it there, the system will think it's a USB stick, so sometimes (but not often) it will treat it like a USB stick. At least that's what happened once on my system but I simply set it not to display that message anymore.
 

Staff online

Members online


Top