Skip to main content
Topic: Folder permissions (chmod) keep resetting on reboot  (Read 1576 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

Folder permissions (chmod) keep resetting on reboot

Recently I've been having an issue where I've been mounting my 2nd HDD on "/mnt/newhdd/" and I'm attempting to change it's chmod permissions to "chmod -R 770" so the group "steam" can have read, write and execute permissions on my HDD folder, otherwise, Steam can't update, install or even run games

But I'm running into this issue where every time I reboot my computer, the chmod permissions seemingly reset, and I need to repeat the same code every time I boot the PC

Is there any way to make my chmod config permanent?
Will mounting my new 2nd HDD on somewhere else like /opt/ or /usr/share/ solve the problem?

 

Re: Folder permissions (chmod) keep resetting on reboot

Reply #1
Add a
Code: [Select]
umask=0007
option to your drive in fstab if you haven't yet.

Re: Folder permissions (chmod) keep resetting on reboot

Reply #2
What filesystem are you using on this disk?



Re: Folder permissions (chmod) keep resetting on reboot

Reply #5
Add a
Code: [Select]
umask=0007
option to your drive in fstab if you haven't yet.
What does this option do specifically?
umask=0007 makes it so that the owner and the group have full access to the mounted drive while others don't have any permissions. You may also have to specify uid and gid, so if your 'steam' user and group's id is 1001 (check it with 'id steam'), add
Code: [Select]
uid=1001,gid=1001

Re: Folder permissions (chmod) keep resetting on reboot

Reply #6

What does this option do specifically?
umask=0007 makes it so that the owner and the group have full access to the mounted drive while others don't have any permissions. You may also have to specify uid and gid, so if your 'steam' user and group's id is 1001 (check it with 'id steam'), add
Code: [Select]
uid=1001,gid=1001

When I use the umask=0007 on my fstab, the HDD seemingly does not start, I can't see it, access or even modify it
I even added the gid and uid for my user as a test but it still won't work
Code: [Select]
UUID=3ada7550-9bf8-4afc-8962-0b8f658e7fba /mnt/newhdd	 ext4    defaults,noatime,umask=0007,uid=1000,gid=1000 0 1
I'm trying to add two users and a group, junessai (uid=1000, gid=1000), luanhenrique (uid=1001 gid=1001) and the group steam (1002), how do I fix this exactly? what am I doing wrong exactly?

Re: Folder permissions (chmod) keep resetting on reboot

Reply #7

umask=0007 makes it so that the owner and the group have full access to the mounted drive while others don't have any permissions. You may also have to specify uid and gid, so if your 'steam' user and group's id is 1001 (check it with 'id steam'), add
Code: [Select]
uid=1001,gid=1001

When I use the umask=0007 on my fstab, the HDD seemingly does not start, I can't see it, access or even modify it
I even added the gid and uid for my user as a test but it still won't work
Code: [Select]
UUID=3ada7550-9bf8-4afc-8962-0b8f658e7fba /mnt/newhdd	 ext4    defaults,noatime,umask=0007,uid=1000,gid=1000 0 1
I'm trying to add two users and a group, junessai (uid=1000, gid=1000), luanhenrique (uid=1001 gid=1001) and the group steam (1002), how do I fix this exactly? what am I doing wrong exactly?

It gives me this message when trying to mount it via sudo mount -a
Code: [Select]
mount: /mnt/newhdd: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.

Re: Folder permissions (chmod) keep resetting on reboot

Reply #8
What if you make some dir  yourself, say /steammnt and mount it there, in case there was a security feature affecting the system owned /mnt? When I have given myself full read write permission on a mounted disk, I mount it somewhere then usually do
Code: [Select]
# chown myname:myname /mntpoint
and that new permission persists after rebooting even if I mount the same drive partition on another mount point, but that is using BTRFS. That isn't as fine grained as what you are trying to achieve so may not be helpful in your case though.

Re: Folder permissions (chmod) keep resetting on reboot

Reply #9
Is there any way to make my chmod config permanent?

I guess you need to change permissions and ownerships of mountpoint before actual mount. Then in will persist after reboots and will apply this permissions during mount according umask. Perhaps you don't need uid and gid parameters, I'm not sure, you may want to try it.

Re: Folder permissions (chmod) keep resetting on reboot

Reply #10


When I use the umask=0007 on my fstab, the HDD seemingly does not start, I can't see it, access or even modify it
I even added the gid and uid for my user as a test but it still won't work
Code: [Select]
UUID=3ada7550-9bf8-4afc-8962-0b8f658e7fba /mnt/newhdd	 ext4    defaults,noatime,umask=0007,uid=1000,gid=1000 0 1
I'm trying to add two users and a group, junessai (uid=1000, gid=1000), luanhenrique (uid=1001 gid=1001) and the group steam (1002), how do I fix this exactly? what am I doing wrong exactly?

It gives me this message when trying to mount it via sudo mount -a
Code: [Select]
mount: /mnt/newhdd: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.

The 1 at the end should be 2 since 1 is used for root partition fscking, 2 is used for any other consequent mounting. If that didn't work, try manually fscking it by running sudo e2fsck -f /dev/sdb1.

And if you want your 2 users to have access to this drive, add them to the 'steam' group with usermod -aG steam username (which I presume you have already done) and change gid and uid to 1002 ('steam' should be both a user and a group).

Hopefully this thing below works.
Code: [Select]
UUID=3ada7550-9bf8-4afc-8962-0b8f658e7fba /mnt/newhdd	ext4    defaults,noatime,umask=0007,uid=1002,gid=1002 0 2

Re: Folder permissions (chmod) keep resetting on reboot

Reply #11
the easiest :

Code: [Select]
# lsblk -f

get /dev, put it on:

Code: [Select]
$ sudo gdisk </dev/..>

type p to understand all situation by listing out
type ? to get help

now depend on 2nd HDD function set correct code, filesystem

type l to get all code info

might be trace by fsck

Re: Folder permissions (chmod) keep resetting on reboot

Reply #12


It gives me this message when trying to mount it via sudo mount -a
Code: [Select]
mount: /mnt/newhdd: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.

The 1 at the end should be 2 since 1 is used for root partition fscking, 2 is used for any other consequent mounting. If that didn't work, try manually fscking it by running sudo e2fsck -f /dev/sdb1.

And if you want your 2 users to have access to this drive, add them to the 'steam' group with usermod -aG steam username (which I presume you have already done) and change gid and uid to 1002 ('steam' should be both a user and a group).

Hopefully this thing below works.
Code: [Select]
UUID=3ada7550-9bf8-4afc-8962-0b8f658e7fba /mnt/newhdd	ext4    defaults,noatime,umask=0007,uid=1002,gid=1002 0 2

It still gives me the same error whenever I attempt to use uid or gid
Code: [Select]
mount: /mnt/newhdd: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.

the easiest :

Code: [Select]
# lsblk -f

get /dev, put it on:

Code: [Select]
$ sudo gdisk </dev/..>

type p to understand all situation by listing out
type ? to get help

now depend on 2nd HDD function set correct code, filesystem

type l to get all code info

might be trace by fsck

When using this command, it says that:
Code: [Select]
Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

What should I do?

Re: Folder permissions (chmod) keep resetting on reboot

Reply #13
Add a
Code: [Select]
umask=0007
option to your drive in fstab if you haven't yet.
What does this option do specifically?
https://linux.die.net/man/2/fstat

https://linuxize.com/post/umask-command-in-linux/

https://www.man7.org/linux/man-pages/man2/umask.2.html

find an old linux bible.  I used to have a few in the NYLXS library

http://www.nylxs.com/docs/unixpowertools.pdf

Re: Folder permissions (chmod) keep resetting on reboot

Reply #14


Specifying the default file mode
You can use the umask command to specify the default mode for newly created files.
Its argument is a three-digit numeric mode that represents the access to be
inhibited—masked out—when a file is created. Thus, the value is the octal comple-
ment of the desired numeric file mode.
If masks confuse, you can compute the umask value by subtracting the numeric
access mode you want to assign from 777. For example, to obtain the mode 754 by
default, compute 777 – 754 = 023; this is the value you give to umask:
$ umask 023
Note that leading zeros are included to make the mask three digits long.
Once this command is executed, all future files created are given this protection
automatically. You usually put a umask command in the system-wide login initializa-
tion file and in the individual login initialization files you give to users when you cre-
ate their accounts (see Chapter 6).
As we mentioned earlier, the chmod command’s actions are affected by the default
permissions when no explicit access class is specified, as in this example:
% chmod +rx *
In such cases, the current umask is taken into account before the file access mode is
changed. More specifically, an individual access permission is not changed unless the
umask allows it to be set.

It takes a concrete example to fully appreciate this aspect of chmod:
$ umask
 Displays the current value.
23
$ ls -l gold silver
----------
 1 chavez chem
 609 Oct 24 14:31
 gold
-rwxrwxrwx
 1 chavez chem
 12874 Oct 22 23:14
 silver
$ chmod +rwx gold
$ chmod -rwx silver
$ ls -l gold silver
-rwxr-xr--
 1 chavez chem
 609 Nov 12 09:04
 gold
-----w--wx
 1 chavez chem
 12874 Nov 12 09:04
 silver
The current umask of 023 allows all access for the user, read and execute access for
the group, and read-only access for other users. Thus, the first chmod command acts
as one would expect, setting access in accordance with what is allowed by the
umask. However, the interaction between the current umask and chmod’s “–” opera-
tor may seem somewhat bizarre. The second chmod command clears only those access
bits that are permitted by the umask; in this case, write access for group and write
and execute access for other remain turned on.

http://www.nylxs.com/docs/essentialsystemadministration_3rdedition.pdf