Yes, you can change the attributes of the file to read-only.
The command is:
chattr +i filename
And to disable it:
chattr -i filename
From man chattr
:
A file with the
i
attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser or a process possessing theCAP_LINUX_IMMUTABLE
capability can set or clear this attribute.
Related Posts:
- Copying a large directory tree locally? cp or rsync?
- Perform rsync while following sym links
- How do I grep recursively?
- Why do you need to put #!/bin/bash at the beginning of a script file?
- error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’ — Missing /var/run/mysqld/mysqld.sock
- “E: Unable to locate package python-pip” on Ubuntu 18.04 [duplicate]
- -bash: syntax error near unexpected token `newline’ for display command
- How do I use grep to search the current directory for all files having the a string “hello” yet display only .h and .cc files?
- SSH using python script
- Changing the resolution of a VNC session in linux
- Building HelloWorld C++ Program in Linux with ncurses
- How does “cat << EOF" work in bash?
- tar removing leading ‘/’ from member names
- X11 forwarding request failed on channel 0
- What is difference between arm64 and armhf?
- Opening a .tar.gz file with a single command
- How to make and apply SVN patch?
- Diff command along with Grep gives “Binary file (standard input) matches”
- How to download a file from server using SSH?
- connect to host localhost port 22: Connection refused
- Implementing shell in C and need help handling input/output redirection
- How to count lines in a document?
- What does `set -x` do?
- Can you Run Xcode in Linux?
- How to get the process ID to kill a nohup process?
- Writing a simple shell in C using fork/execvp
- Implementation of multiple pipes in C
- chmod: changing permissions of ‘my_script.sh’: Operation not permitted
- Using ls to list directories and their total sizes
- tar: add all files and directories in current directory INCLUDING .svn and so on
- What does set -e mean in a bash script?
- Gedit command not working in kali linux terminal
- Syntax error near unexpected token ‘then’
- Curl : connection refused
- make -j 8 g++: internal compiler error: Killed (program cc1plus)
- Bash export command
- Pipe to/from the clipboard in a Bash script
- what does -zxvf mean in tar -zxvf filename?
- Retrieve last 100 lines logs
- Linux Bash: Move multiple different files into same directory
- Configuring Apache for localhost
- how to search for a directory from the terminal in ubuntu
- Android – Command not found
- How to use dos2unix?
- EC2 ssh Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
- How to add a default include path for GCC in Linux?
- What does ‘bash -c’ do?
- How do I know the script file name in a Bash script?
- WordPress can’t find temporary folder, but folder it’s looking at has correct permissions
- How to configure both webserver and appserver for WordPress CMS?
- How to remove all plugins, posts, pages, and inactive themes in one line with wp-cli? WordPress bloatware removal
- Communcation with wordrpess and linux server [closed]
- How can I sort du -h output by size
- What exactly do the colors in htop status bars mean?
- How to run a server on port 80 as a normal user on Linux?
- Showing total progress in rsync: is it possible?
- How to bind MySQL server to more than one IP address?
- Check if port is open or closed on a Linux server?
- Moving an already-running process to Screen
- When does `cron.daily` run?
- What’s the best way of handling permissions for Apache 2’s user www-data in /var/www?
- Permission denied (publickey). SSH from local Ubuntu to Amazon EC2 server
- How to run a command multiple times, using bash shell?
- How to setup passwordless `sudo` on Linux?
- LVM dangers and caveats
- How to reconnect to a disconnected ssh session
- Should I quit using Ifconfig?
- How to know from which yum repository a package has been installed?
- How do I verify the speed of my NIC?
- SSL Certificate Location on UNIX/Linux
- What is “-bash: !”: event not found”
- tar – Remove leading directory components on extraction
- Keeping a linux process running after I logout
- Force dig to resolve without using cache
- Job scheduling using crontab, what will happen when computer is shutdown during that time?
- How to list Apache enabled modules?
- How to forcibly close a socket in TIME_WAIT?
- How to check if an RSA public / private key pair match
- how do you create an ssh key for another user?
- How can I monitor hard disk load on Linux?
- What’s the reverse DNS command line utility?
- How to add a security group to a running EC2 Instance?
- How bad is it really to install Linux on one big partition?
- How do I extract login history?
- SSH from A through B to C, using private key on B [closed]
- Show all users and their groups/vice versa
- Is it possible to reboot a Linux OS without rebooting the hardware?
- SSHFS mount that survives disconnect
- Temporarily ignore my `~/.ssh/known_hosts` file?
- Does the “bs” option in “dd” really improve the speed?
- How to get TX/RX bytes without ifconfig?
- What solutions exist to allow the use of revision control for server configuration files? [closed]
- Curl: disable certificate verification
- Is there a way to do a remote “ls” much like “scp” does a remote copy?
- How to apply a filter to real time output of `tail -f `?
- Practical maximum open file descriptors (ulimit -n) for a high volume system
- Dump a linux process’s memory to file
- How to handle relative urls correctly with a reverse proxy
- What is the difference between /sbin/nologin and /bin/false?
- Where’s the conventional place to store git repositories in a linux file system tree?