Sometimes you may need to make a file unreadable in Linux to protect it from accidental access. You can easily do this by modifying its file permissions. These changes are permanent and persist even after your session ends. In this article, we will learn how to make file unreadable in Linux.
How to Make File Unreadable in Linux
Let us say you want to make a file data.txt unreadable in Linux. Here is a simple command to do it.
$ chmod 600 data.txt
In the above command, we assign permission 600 to our target file to make it readable & writable only by owner of the file.
Similarly, you can also use the following command to remove read(r), write(w), execute(x) permission from group and others.
$ chmod go-rwx data.txt
You can use these commands to make even folders unreadable. In this article, we have learnt how to make file unreadable in Linux.
Also read:
How to Measure Elapsed Time in Python
How to Create ISO Image from CD in Linux
How to Export Pandas Dataframe to Multiple Excel Sheets
How to Export Pandas Dataframe to Excel
How to Export Pandas Dataframe to PDF
Related posts:
How to Send Email With Attachment in Linux
How to Delete Last Field in Linux
Shell Script to Count Number of Words in File
Grep Exclude Directory & Files
Install KeepAlived in CentOS 7 from source
How to Run Linux Commands Without Logging in History
How to Find All Symlinks to File/Directory
How to Install Virtualenv in Ubuntu

Sreeram has more than 10 years of experience in web development, Python, Linux, SQL and database programming.