[Solved] Mount permissions HDD

New to Debian (Or Linux in general)? Ask your questions here!

[Solved] Mount permissions HDD

Postby Lamios » 2018-01-21 16:13

Hello,

currently I installed mpd on my Debian 9. Mpd works fine, except that it cannot play music from my HDD I share with Windows. The HDD is ntfs formatted and owned by root. To solve the resulting permission problem for mpd, I thought to automatically mount the HDD with user permissions. In the moment I have created the respective folder for the mounting in /media
I wanted to extend fstab by the following line:
UUID=MediaUUID /media/Volume ntfs-3g defaults, auto, uid=Myuid, gid=????, umask=??? 0 0
Now I have the problem that I don't know which ID I have to use for the group. Which group should one normally use as group owner for mounted HDDs? I have all my data on this HDD, not only music. Thus, audio is maybe not the right group.
And finally, which permissions should I assign? Here I thought about 023, but I am not sure if this is appropriate.

Thanks for your help!
Last edited by Lamios on 2018-01-26 20:18, edited 1 time in total.
Lamios
 
Posts: 37
Joined: 2017-12-09 23:26

Re: Mount permissions HDD

Postby dotlj » 2018-01-22 07:04

If you share a HDD with Windows, why set the owner to root, and not to your user ID?
why not simply
chown -R lambios:lambios /media/Volume

Then you won't have permission problems.
Your user is probably a member of the groups needed, as you say Mpd works fine.
User avatar
dotlj
 
Posts: 599
Joined: 2009-12-25 17:21


Re: Mount permissions HDD

Postby p.H » 2018-01-22 11:18

dotlj wrote:why not simply
chown -R lambios:lambios /media/Volume

Because that does not work with NTFS. The NTFS format ignores Unix permissions so they have to be set at mount time with mount options as in the OP's post.
p.H
 
Posts: 437
Joined: 2017-09-17 07:12

Re: Mount permissions HDD

Postby Lamios » 2018-01-22 21:23

Thank you for your answers.
I had been able to find the the group for my user.
Now the only question is, which permissions should I set to maintain privacy?
Lamios
 
Posts: 37
Joined: 2017-12-09 23:26

Re: Mount permissions HDD

Postby bw123 » 2018-01-22 21:37

I don't understand why you're having trouble, when I mount an ntfs partition I am able to access everything on it with a simple mount command:

Code: Select all
# mount /dev/sdb1 /mnt
# mount | grep mnt
/dev/sdb1 on /mnt type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)


I can read and write files as a regular user just fine. I do have pkg ntfs-3g installed.

which permissions should I set to maintain privacy?


What privacy? They are music files. Who do you want privacy from?

UUID=MediaUUID /media/Volume ntfs-3g defaults, auto, uid=Myuid, gid=????, umask=??? 0 0


Be sure no spaces in your string of options, but I would think just defaults should work for fstab entry. Just get it working first and worry about fine-tuning later. Don't make it complicated unless you have to.
User avatar
bw123
 
Posts: 3188
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Mount permissions HDD

Postby Lamios » 2018-01-22 23:59

Thanks.
I mounted the HDD. The mounting worked fine. However, mpd is not able to read music from the HDD (but is able to read some from /home). In the moment umask=023, but I also changed it to 000 once, which did not change anything.
The first time I accidentally copied the line with the spaces and than mpd had been playing music from the HDD, but I got some problems during unmounting. Thanks for the hint with the spaces, I wouldn't have seen that. Did I make a mistake in the string of options?
Code: Select all
UUID=MyUUID /media/Volume ntfs-3g defaults,auto,uid=Myuid,gid=Mygid,umask=023 0 0
Lamios
 
Posts: 37
Joined: 2017-12-09 23:26

Re: Mount permissions HDD

Postby bw123 » 2018-01-23 00:17

You're just making it too hard, and it's really not that complicated. I think you should study more about linux with ntfs before you really wreck something. Please don't type in any commands you find on the internet.

UUID=MyUUID /media/Volume ntfs-3g defaults,auto,uid=Myuid,gid=Mygid,umask=023 0 0


Is this some kind of code because you don't want to copy and paste, or you think people on here will hack your UUID, UID, and GID or what? What's the umask=23 supposed to do?

have you tried with just the default mount options? Who told you that you needed all this complicated stuff?
User avatar
bw123
 
Posts: 3188
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Mount permissions HDD

Postby debiman » 2018-01-23 07:00

can you access the ntfs partition normally? through filemanager, terminal?
did you look at the search results i provided?
User avatar
debiman
 
Posts: 2613
Joined: 2013-03-12 07:18

Re: Mount permissions HDD

Postby Lamios » 2018-01-23 12:13

I did read your search results. Most of them I had read during my research before my post.

The ntfs is accessible and I am able to write on it or play music with another player.

Permissions and ownership for the test music library I created in /home are identical to the ones from my music folder on the HDD.
ls -al on the HDD gives the following (I am not sure if it is helpful):
Code: Select all
:/media/Volume# ls -al                                                                                                                                                                                                                                       
total 784                                                                                                                                                                                                                                                                     
drwxr-xr-- 1 user user   8192 Jan 23 12:20 .                                                                                                                                                                                                                 
drwxr-xr-x 5 root          root            4096 Jan 21 16:19 ..                                                                                                                                                                                                               
drwxr-xr-- 1 user user   4096 Jan 21 18:41 Pictures                                                                                                                                                                                                                                                                                                                                                                                                           
drwxr-xr-- 1 user user  32768 Jan 16 14:18 Documents                                                                                                                                                                                                                                                                                                                                                                                                     
drwxr-xr-- 1 user user  65536 Jan 13 23:08 Music 

Could it be caused by the second line, which ends with .. and has root as owner?

I also tried to run mpd as user. I than only got the following error after reboot: Connection to "Default" (localhost:6600) failed
But I think that does not reflect the problem that mpd cannot play music from HDD when set to user mpd?
Lamios
 
Posts: 37
Joined: 2017-12-09 23:26

Re: Mount permissions HDD

Postby bw123 » 2018-01-23 19:20

Lamios wrote:
drwxr-xr-- 1 user user 65536 Jan 13 23:08 Music
<snip>
Could it be caused by the second line, which ends with .. and has root as owner?
<snip>
...the problem that mpd cannot play music from HDD when set to user mpd?


No, it's not because of the second line.
User avatar
bw123
 
Posts: 3188
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Mount permissions HDD

Postby Lamios » 2018-01-23 22:10

0k. Is there anything I could post that might help to find the cause for the problem?
Lamios
 
Posts: 37
Joined: 2017-12-09 23:26

Re: Mount permissions HDD

Postby bw123 » 2018-01-23 22:34

Lamios wrote:0k. Is there anything I could post that might help to find the cause for the problem?


It's because you have removed the search bit for the directories. I didn't even know you could do this on ntfs, how you managed it? You don't need to change permissions and ownership without understanding what it does. I really don't know how to fix it on ntfs. I never used chmod or chown on ntfs before. I always mount ntfs with default options and owner is root:root with 777 permissions and that works fine for me. I have never seen an ntfs part mounted on linux that had two different owners on the files/dirs.

If that really is an ntfs partition, then you are probably doing something odd to mount it? Maybe you installed some kind of add-on that you forgot to mention?

Code: Select all
$ mkdir foodir
$ ls -al
total 12
drwxr-xr-x  3 me me 4096 Jan 23 18:13 .
drwxr-xr-x 20 me me 4096 Jan 23 18:13 ..
drwxr-xr-x  2 me me 4096 Jan 23 18:13 foodir
$ su
Password:
# chown vnstat:vnstat foodir
# chmod 754 foodir
# exit
exit
$ ls -al
total 12
drwxr-xr-x  3 me    me    4096 Jan 23 18:13 .
drwxr-xr-x 20 me    me    4096 Jan 23 18:13 ..
drwxr-xr--  2 vnstat vnstat 4096 Jan 23 18:13 foodir
$ ls -al foodir
ls: cannot access 'foodir/.': Permission denied
ls: cannot access 'foodir/..': Permission denied
total 0
d????????? ? ? ? ?            ? .
d????????? ? ? ? ?            ? ..
User avatar
bw123
 
Posts: 3188
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Mount permissions HDD

Postby Lamios » 2018-01-23 23:11

In don't know. All I did (as far as I know) is adding this line to /etc/fstab
Code: Select all
UUID=0BE7094A0BE7094A /media/Volume ntfs-3g defaults,auto,uid=Myuid,gid=Mygid,umask=023 0 0
and creating the folder Volume in /media.

What does it mean to
have removed the search bit for the directories

and how do you see it?
Lamios
 
Posts: 37
Joined: 2017-12-09 23:26

Re: Mount permissions HDD

Postby bw123 » 2018-01-23 23:32

Code: Select all
defaults,auto,uid=Myuid,gid=Mygid,umask=023 0 0
    ^     ^    ^         ^         ^
good|     |    |         |         |
    why? -|    |         |         |
         why? -|         |         |
                   why? -|         |
                             wtf? -|


drwxrwxrwx
   ^  ^  ^
   |  |  |
   |________ dir srch bits

User avatar
bw123
 
Posts: 3188
Joined: 2011-05-09 06:02
Location: TN_USA

Next

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable