Setting file permissions in Linux

, , No Comments
All files in Linux have permissions set (or unset) for user, group and other users. It’s indicated as –rwxrwxrwx or similar.
To display a file’s permission settings, type ls -l filename
The first character indicates the filetype e.g. ordinary file, directory…
The next 3 characters indicate the permission for the file owner (user), then next 3 for users in the owner’s group and the last 3 for other users.
r = Read  w = Write  x = Execute
Easiest way to change a file’s permission is to use chmod u/g/a +/- rwx filename e.g. chmod a+w file.txt to give everyone write permission on the file, file.txt
You can also use numeric arguments and common ones are –
chmod 400 to give only read permission to owner
chmod 600 to give read and write permission to owner
chmod 644 to give everyone read permission and the owner write permission
chmod 775 to give everyone read + execute, owner + group read write execute permission
chmod 777 to give everyone read write exceute permission


Post a Comment

You can be sure of a response, a very relevant one too!

Click on Subscribe by Email just down below the comment box so you'll be notified of my response.