As you may know that chmod command allows you to set certain permissions for files on your Web server. This command is commonly used to set permissions for Perl CGI scripts and the files that go with them. For instance, many scripts are set with the permissions for the owner to be able to read, write, and execute the file; while the permissions for the group and other (anybody) are set to allow them only read and execute permissions.
If you already have a file with the permissions you want to assign to some other files, you can use –reference option in chmod. Of course, remember you need to be the root or admin to do so.
Command
$ chmod –reference
Example
$ chmod –reference 1.cgi 2.cgi
(then you will see that both cgi files are the same permission using ls -al)
Simple as 123~

