Description

How to change file permission fstab in /etc/ directory (eliminate read and write permissions for group and others, leaving only for user (root))

root@vSRX3_2:/etc # pwd

/etc

root@vSRX3_2:/etc # ls -alF | grep fstab

-rw-r--r--  1 root wheel  151 Jul 31 2023 fstab

root@vSRX3_2:/etc # 

Solution

The "fstab" file is responsible for defining where and how disk partitions, storage devices and file system should be mounted, for example the disk where the root file system is mounted, this information is used at boot time to mount the filesystems automatically.

 

You can limit the access to read and write for the root user using "chmod 600" from the shell, this will only allow the root user to read from or write to this file.

 root@vSRX3_2:/etc # ls -alF | grep fstab

-rw-r--r--  1 root wheel  151 Jul 31 2023 fstab

 

root@vSRX3_2:/etc # chmod 600 /etc/fstab 

 

root@vSRX3_2:/etc # ls -alF | grep fstab

-rw-------  1 root wheel  151 Jul 31 2023 fstab

root@vSRX3_2:/etc # 

 

Editing this file shouldn't cause any issues, however, only the root user will be able to mount disks like a USB drive and only the root user will be able to properly run the "mount" command.

Since "fstab" is used by the system we would suggest making these changes during a MW and monitor the state of the device to make sure it works as intended.

 

Modification History

2024-12-11 : Article Created