chown <owner-user>:<owner-group> <file or directory>
chown cti.cti /var/log/cx
in the above example, cti.cti is user and /var/log/cx is a folder. Similarly using -R option, the ownership of all the files and folders can be changed recursively.
chown -R cti.cti /var/log/cx
The chmod command changes the access mode of one file or multiple files.
The syntax for the chmod command is:
chmod [option] mode files
|-R||Descend directory arguments recursively while setting modes.|
|-f||Suppress error messages if command fails.|
|Who||u=user, g=group, o=other, a=all (default)|
|Opcode||+ means add permission
– means remove permission
= means assign permission and remove the permission of unspecified fields
|Permission||r=Read, w=write, x=Execute, s=set uid bit, t=sticky bit
u=user, g=group, o=other, l=mandatory locking
chmod 777 /home/cx/etc
In the above example, 777 means full access to user,group and others and /home/cx/etc is directory
The commands can be used to with -R option to perform the command recursively where all the subdirectories and files shall be set with the same permission eg:-
chmod -R 777 /home/cx/etc
The +x option gives everyone to execute the file.
chmod +x /home/cx/etc/script/install.sh
More information can be found at the following link: