How To Prevent Deleting Files Accidentally?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/prevent-deleting-files-accidentially/
PINTEREST
PINTEREST
INSTAGRAM

Every system admin horror is deleting files accidentally especially important and not backup ed configuration files. Here is how can we recover deleted files from Linux systems which is next situation if we skipped this step.

Ask Before Deleting Files

rm is defacto tool to remove files from Linux system. We can setup a mechanism to ask before deleting files with simple alias setup like below.

This will add new alias for rm command with -i  option.

Login and Use Less Privileged User /Do Not Use Root Always

Using root user makes system administrator more powerful and less problematic but as you guess power without control will create problems. Use less powerful user with sudo capability which is default in Ubuntu.

Change Permissions and Owner User Group

Keep permissions strict so do not give 777 to files as far as it is not needed.

We can change permission like

Add Protected Attribute

Linux provides read only attribute which can be given by root. This attribute will make file read only.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/prevent-deleting-files-accidentially/
PINTEREST
PINTEREST
INSTAGRAM
LEARN MORE  How to Become SuperUser or Root with su Command In Linux?