How Do You Change a File to Read Write in Linux?
Contents

How do I change the mode of a file in Linux?

To change file and directory permissions, use the command chmod (change mode). The owner of a file can change the permissions for user ( u ), group ( g ), or others ( o ) by adding ( + ) or subtracting ( – ) the read, write, and execute permissions.

How do I make a file read only in Linux?

You can alter a file’s permissions with the ‘chmod’ command:

  1. Read-only to your UID (userid): chmod 400 <filename>
  2. Read-only to you and your GID (group): chmod 440 <filename>
  3. Read-only to everyone: chmod 444 <filename>
Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest