Logo ← PostgreSQL Blog

Chmod & chown in Linux

Changing Permissions:

Chmod & chown in Linux

Changing Permissions:

  • chmod +x name.sh: Grants execute permission to the file name.sh.
  • chmod 777 /notes.txt: Provides read, write, and execute permissions to everyone for the file notes.txt.
  • chmod +x /notes.txt: Adds execute permission to notes.txt.
  • chmod +r /notes.txt: Adds read permission to notes.txt.
  • chmod +w /notes.txt: Adds write permission to notes.txt.
  • chmod 0 /notes.txt: Removes all permissions from notes.txt.
  • chmod -x /notes.txt: Removes execute permission from notes.txt.
  • chmod 775 /notes.txt: Provides read, write, and execute permissions to the owner and group, and read/execute permissions to others for notes.txt.
  • chmod -x /notes.txt: Deletes execute permission from notes.txt.

Changing Ownership and Groups:

  • sudo chown $USER:$USER /mnt/drive1/Movies: Changes the ownership and group of the directory /mnt/drive1/Movies to the current user.
  • sudo chown oracle:oinstall /a: Changes the ownership to user oracle and the group to oinstall for directory /a.