You are not logged in.

#1 2015-11-09 20:29:03

freebe
Member
From: Germany
Registered: 2015-10-29
Posts: 41

[SOLVED]Cannot write in partitions even if they are mounted as rw,user

The Title describes my Problem pretty good.

In my fstab-file I mounted a few partitions with

rw,auto,user

but I can still not write into them without using the sudo/su command. I have no Idea why.

Any suggestions?

Last edited by freebe (2015-11-12 21:14:03)

Offline

#2 2015-11-09 20:38:29

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

I believe you misunderstand the user option. It allows users to mount the partition but it has nothing to do with the permission to access files on the mounted partition. It does not make sense with the auto option because the auto option automatically mounts the partition. It is useful with the noauto option. The permissions depend of the filesystem. For Unix filesystems (like ext{2,3,4}), the permissions are set on the files and you will have to use chmod as usual. For a vfat file system, you can use the umask/fmask/dmask options (as well as uid, gid). To let anyone do anything with the mounted files, you can use umask=0000; see "man mount" for details.

Last edited by olive (2015-11-09 21:02:01)

Offline

#3 2015-11-09 22:12:36

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

Post your whole fstab


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#4 2015-11-10 12:48:14

freebe
Member
From: Germany
Registered: 2015-10-29
Posts: 41

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

Thanks for your replies!
My umask settings in /etc/profile where at 022, I changed them now to 027. I added the same umask to ~/.bashrc. The first number is for the current user, right? So I should have all the necessary permissions...

my fstab-file now:

# /dev/sdb1
UUID=blablabla            /                       ext4            rw,relatime,data=ordered        0 1

# /dev/sdb3 LABEL=antiX15home
UUID=blablabla        /home                   ext4            rw,relatime,data=ordered        0 2

# /dev/sdb2
UUID=blablabla                none                    swap            defaults                        0 0


# /dev/sdc4

# /dev/sdc5 ext4  
UUID=blablabla           /media/crypt            ext4            rw,user,exec                    0 0
  
# /dev/sdc6 vfat    
UUID=blablabla              /media/box            vfat            rw,user,exec                    0 0

# /dev/sdc7 ntfs    
UUID=blablabla     /media/winfiles              ntfs-3g         rw,user,exec                    0 0

Last edited by freebe (2015-11-10 12:48:35)

Offline

#5 2015-11-10 13:20:54

LCvanDinteren
Member
From: Netherlands
Registered: 2015-10-27
Posts: 153

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

I'm no expert on permissions, but I think the order is owner - group - other
So it makes more sense to me to give 777 permissions.
I think that with 027 you won't be able to access the folder as root. This could be useful, however, if you have a partition that could contain malicious software for instance.

Edit: perhaps you can try using default settings first (replace rw, user, exec with defaults) see if that works.

Last edited by LCvanDinteren (2015-11-10 13:22:44)

Offline

#6 2015-11-10 13:32:19

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,868
Website

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#7 2015-11-10 13:50:27

freebe
Member
From: Germany
Registered: 2015-10-29
Posts: 41

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

@ LCvanDinteren:

The umask values are the negated values of chmod, that means umask 777 is chmod 000. So with 777 the file would have no permissions to anyone.

@ WorMzy

Okay, that looks good. I didn't know I can set umask and gid/uid as options in the fstab. I'll try that!

Offline

#8 2015-11-10 14:09:55

LCvanDinteren
Member
From: Netherlands
Registered: 2015-10-27
Posts: 153

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

freebe wrote:

@ LCvanDinteren:

The umask values are the negated values of chmod, that means umask 777 is chmod 000. So with 777 the file would have no permissions to anyone.

Oops! My bad.
But this means you gave even less permissions than it had before (removed wx on other), this makes no sense to me.
Maybe I have a naive approach, but I usually start debugging these kind of problems by starting with the most basic setup and see where it goes wrong as I apply my desired changes.
So in this case I would start by using default settings, umask 000, perhaps even try to mount manually in my home folder.

You say your umask is set on /etc/profile, have you also tried this?

umask -R 027 /mount

Offline

#9 2015-11-10 17:37:49

freebe
Member
From: Germany
Registered: 2015-10-29
Posts: 41

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

Yes, I reduced the permissions, because I do not want everyone to look at / excecute my files. smile

Adding umask as option for the fat-partition and gid+uid for the ntfs-partition solved the problem. smile I can now work with the partitions as if they were my home partition. This is how the two partitions look now on my fstab:


# /dev/sdc6 vfat  
UUID=blablabla           /media/box            vfat                user,rw,umask=000                                  0 0
  
# /dev/sdc7 ntfs  
UUID=blablabla           /media/winfiles            ntfs-3g            uid=freebe,gid=users,umask=0027                0 0

Thank you guys for helping!

The only thing I'm concerned about now ist that everyone can acces the fat partition now. Is that right?
When I tried it with umask 007, I couldn't access it as the user. It only works with umask 000.

LCvanDinteren wrote:

@ LCvanDinteren:
You say your umask is set on /etc/profile, have you also tried this?

umask -R 027 /mount

I didn't try that. Will try it at the next boot

Last edited by freebe (2015-11-10 17:43:20)

Offline

#10 2015-11-10 17:50:46

loqs
Member
Registered: 2014-03-06
Posts: 17,377

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

freebe wrote:
LCvanDinteren wrote:

@ LCvanDinteren:
You say your umask is set on /etc/profile, have you also tried this?

umask -R 027 /mount

I didn't try that. Will try it at the next boot

$ mkdir test
$ umask -R 027 test
bash: umask: -R: invalid option
umask: usage: umask [-p] [-S] [mode]

LCvanDintern did you try that command before you suggested it?

Offline

#11 2015-11-10 18:39:18

LCvanDinteren
Member
From: Netherlands
Registered: 2015-10-27
Posts: 153

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

loqs wrote:
freebe wrote:
LCvanDinteren wrote:

@ LCvanDinteren:
You say your umask is set on /etc/profile, have you also tried this?

umask -R 027 /mount

I didn't try that. Will try it at the next boot

$ mkdir test
$ umask -R 027 test
bash: umask: -R: invalid option
umask: usage: umask [-p] [-S] [mode]

LCvanDintern did you try that command before you suggested it?

I'm sorry, it came straight from my Ubuntus history..
the idea was to set the permissions on the mount folder

try: (tested this..)

cd /mount
umask 027

Offline

#12 2015-11-10 18:57:45

loqs
Member
Registered: 2014-03-06
Posts: 17,377

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

LCvanDinteren wrote:

I'm sorry, it came straight from my Ubuntus history..
the idea was to set the permissions on the mount folder

try: (tested this..)

cd /mount
umask 027
man umask wrote:

The umask utility shall set the file mode creation mask of the  current
       shell execution environment (see Section 2.12, Shell Execution Environ‐
       ment) to the value specified by  the  mask  operand.  This  mask  shall
       affect  the  initial  value of the file permission bits of subsequently
       created files.

Note permissions for the current shell,  it has no interaction with the file system.
Even if it was set global in for instance /etc/profile mount as provided by systemd does not use a shell so the value there would not be respected.
Also as a security measure any other user could simply change the value of the umask.
It does seem you are confusing the umask parameter in the options string passed to mount with the sehll built-in of the same name.

Offline

#13 2015-11-10 19:18:04

LCvanDinteren
Member
From: Netherlands
Registered: 2015-10-27
Posts: 153

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

And how about chmod then? would something like chmod 750 /mount work?

Just blurting brainfarts here..

Offline

#14 2015-11-10 19:23:08

loqs
Member
Registered: 2014-03-06
Posts: 17,377

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

freebe wrote:

The only thing I'm concerned about now ist that everyone can acces the fat partition now. Is that right?
When I tried it with umask 007, I couldn't access it as the user. It only works with umask 000.

Assuming I understand correctly that should be mounted at /media/box.
What is the output of

$ls -lad /media/box

Edit:

LCvanDinteren wrote:

And how about chmod then? would something like chmod 750 /mount work?

Covered by olive in post #2 of this thread.

Last edited by loqs (2015-11-10 19:29:49)

Offline

#15 2015-11-10 19:28:17

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,868
Website

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

And how about chmod then? would something like chmod 750 /mount work?

[assuming you mean running chmod on the mountpoints]

No, because FAT and NTFS aren't UNIX permission-compatible (although you can use the "permissions" option to make ntfs-3g masquerade as though it is -- see the end of the ntfs-3g wiki page I linked above).


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Online

#16 2015-11-10 19:52:43

freebe
Member
From: Germany
Registered: 2015-10-29
Posts: 41

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

loqs wrote:
freebe wrote:

The only thing I'm concerned about now ist that everyone can acces the fat partition now. Is that right?
When I tried it with umask 007, I couldn't access it as the user. It only works with umask 000.

Assuming I understand correctly that should be mounted at /media/box.
What is the output of

$ls -lad /media/box

The output is

drwxrwx--- 27 root root 65536 Jan  1  1970 /media/box
drwxrwxrwx 27 root root 65536 Jan  1  1970 /media/box 

with umask 007 and umask 000 respectively

freebe wrote:
LCvanDinteren wrote:

You say your umask is set on /etc/profile, have you also tried this?

umask -R 027 /mount

I didn't try that. Will try it at the next boot

I refrained from doing that, after reading the following replies. smile

Offline

#17 2015-11-10 20:25:59

loqs
Member
Registered: 2014-03-06
Posts: 17,377

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

freebe wrote:

The output is

drwxrwx--- 27 root root 65536 Jan  1  1970 /media/box
drwxrwxrwx 27 root root 65536 Jan  1  1970 /media/box 

with umask 007 and umask 000 respectively

So this shows it is owned by the user root and the group root.
With the 007 umask only the above have access.
With the 000 umask the above + other have access.
Given what you have said already it would seem you want to change the owning group or user the same way you did for the ntfs partition.
The user option as had already been noted seems odd here as the filesystem would be mounted at boot time as you have not specified noauto option.
So a user can not use that mount as it has already been mounted by root.

Offline

#18 2015-11-12 21:12:13

freebe
Member
From: Germany
Registered: 2015-10-29
Posts: 41

Re: [SOLVED]Cannot write in partitions even if they are mounted as rw,user

Wow, you left me thinking over your post a while... smile
Just today it clicked. big_smile I did the same to the vfat-partition... Just as you said. This is my fstab-file now:

# /dev/sdc6 vfat  
UUID=blablabla           /media/box                 vfat               uid=freebe,gid=users,umask=0027                    0 0
  
# /dev/sdc7 ntfs  
UUID=blablabla           /media/winfiles            ntfs-3g            uid=freebe,gid=users,umask=0027                0 0

The output of ls -lad /media/box is

drwxr-x--- 27 freebe users 65536 Jan  1  1970 /media/box/

So it is now owned by the user freebe and the group users smile

Now it works excactly how I want it to smile)
Thank you!!!

Offline

Board footer

Powered by FluxBB