To change mode of a file system object. Files can have r – read, w- write and x-execute permissions. For example: chmod mode FILE chmod 744 script.sh The first number stands for the user who is associated with the file The second number is for the group associated with the file The third number is associated with everyone else who is not a part of the user or group
$ chmod 744 script.sh
letters u= user, g= group, o= others
= set the permission exactly like this
r= read, w= write, x= executef
chmod u=rwx, g=rx, o=r my file
set the permissions owner can read and write , group can read only, others can read only
chmod 644 file.htm
recursively (-R) change the permssion of the directory and all folders and files it contains to mode 755.
chmod -R 755 my files
change the permissions for the owner so that the owner can read and write
chmod u=rw example.jpg
set the user ID so anyone can acccess the file
chmod u+s comphope.txt
does not give access to every user
chmod u-s comphone.txt
read and wwrite to everyone
chmod a=rw file.txt
change the client c permission so that owner cannot write but can only see
chmod u=r assign1 client.c
change the client c permission so that owner cannot write but can only see
chmod u=r assign1 client.c
after applying this command the user cannot change the directory
chmod u=rw exam
it will set the read and wrote permission for other users of text files
chmod o+W* .txt
user have read and write permissions. group and others have only read permission
chmod u=rw, go= r new_file.txt
ewe can add the execute permission for everyone.
chmod a+x new_script.sh
remove read permission for others
chmod o-r *.page
to change the owner of the file
chown owner file file name
to change ownership to root use sudo
sudo chown root file1.txt
reports when file change is made
chown -c master file.txt
change permissions for the group and writ permissions for file.txt file
chmod g+w file.txt
change permissions for the group and writ permissions for file.txt file
chmod g+w file.txt
it changes the permisions for all the owner,group and other users
$chmod +a sfile.txt
this command removes read and execute permissions from file.txt.
chmod r-wx file.txt
changes the files and directories recursively
chmod -R file.txt