/etc/profile umask 022 vs 027

versatile 64-bit multi-user Linux distribution

Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators

Post Reply
user1111

/etc/profile umask 022 vs 027

Post by user1111 »

Mikeslr raised a interesting point that fundamentally distils down to why is fatdog using umask 022 in /etc/profile instead of 027 (no access for 'others') ?

On a HDD frugal multi-session setup, where main and save files (sfs) are stored in /mnt/sda1/fatdog811 ... spot has access to those by default i.e. could copy those files to a hackers server for inspection at their leisure. umask 027 prevents such access to new/additional 'saves'.

step
Posts: 546
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 57 times
Been thanked: 198 times
Contact:

Re: /etc/profile umask

Post by step »

I can't give you a definitive answer about the why, because that decision predates my coming to Fatdog64, but I can comment that 022 is quite common across the Linux spectrum. For instance, this is what Arch says:

Most Linux distributions, including Arch, set a umask default value of 022 [...]

If you need to set a different value, you can either directly edit such file, thus affecting all users, or call umask from your shell's user configuration file, e.g. ~/.bashrc to only change your umask, however these changes will only take effect after the next login. To change your umask during your current session only, simply run umask and type your desired value. For example, running umask 077 will give you read and write permissions for new files, and read, write and execute permissions for new folders.

My take on the principle underlying 022 across the Linux spectrum is that the responsibility for hardening the system is left to the savvy administrators who understand the myriad ways a system can be compromised, including via the wrong umask. 022 is a reasonable compromise between default security and usability: everyone can read files (unless a specific file's permissions are hardened) but only file owners can change their files.

jamesbond
Posts: 717
Joined: Tue Aug 11, 2020 3:02 pm
Location: The Pale Blue Dot
Has thanked: 124 times
Been thanked: 402 times

Re: /etc/profile umask

Post by jamesbond »

@step you hit the nail on the head.

@rufwoof it is probably more important to specify the access rights of the mountpoint /mnt/sda1 and make sure that only root can do it. At one point in time I actually did that by default, but it caused too much headaches. If you use the full Fatdog (not pugdog or slimdog) you can control that by running Fatdog Event Manager from Control Panel -> Desktop, for devices mounted at boot you can specify SAVEDEVICE_MODE=xxx as you see fit. The default value is 755 for Linux filesystems and 775 for vfat and ntfs.

user1111

Re: /etc/profile umask 022 vs 027

Post by user1111 »

Thanks James. Not really a issue/bother for me, but there is something in the 'secure by default' approach ... for those that aren't "savvy admin".

Same for /sys/devices/virtual/dmi/id ... file permissions, there's really no need for 'others', such as userid spot, to have read access to the likes of motherboard (or other) serial numbers. Nor come to that should spot really be able to run/view hardinfo or suchlike. Restricting networking to spot as Fatdog does is great :thumbup:, but then if spot can access data drives, read/forward hardware info ...etc. :thumbdown: For instance if you use spot to ssh into servers using keys, then file:///home/spot/.ssh/id_rsa ... etc files could be read within the browser and forwarded onto a hackers server

Post Reply

Return to “FatDog64”