I added a file in
/etc/init.d but noticed that the file isn't a green color like the other files when I do a
ls -l What should I do to make it "green" or add the necessary file permissions?
Why are the files green in the first place?
To answer your question
All you need to do is run the following command as root.
Now, if you want to actually know why this works, continue reading.
Permission are very easy to understand once someone explains them to you. All files and directories have 3 types of permissions and 3 different groups of people that can have different permissions.
All users can have the following permissions on files and directories:
These rights are given to 3 groups of people:
On a Linux system, when you do an ls -l on /etc/init.d, you get results like:
The first part (-rwxr-xr-x) lists the permissions, the third shows the owner (root), and the forth shows the group (root).
The permissions list is split into four parts. The first letter is the file type. If it is a file, it is a dash. If it is a directory it is a d. If it is a link it is an l. The next three letters represent the rights of the owner. rwx means the user can read, write, and execute. The next three letters represent the permissions of the group. The group in this case can only read an execute (r-x). W is replaced with a dash meaning it is not allowed. Finally, everyone not belonging to the group is given read and execute permissions (r-x).
Modifying permissions and ownership
Now that we have gone over identifying permissions, we can modify them.
chmod is the tool for changing permissions. A good example of its use is the one I gave you at the beginning of this answer.
The first argument (755) gives the permissions and the next arguments are this list of files to modify.
The permission list 755 is a short way of saying -rwxr-xr-x. The first number is the permission for the owner, the second is the permission for the group. and the third is the permission for others. Each number represents rwx.
The sum of the permission numbers is use in the chmod command. So, 7 is all rights (4+2+1) and 5 is read and execute (4+1).
So, putting it all together 755 is
chown is the tool for changing ownership and groups. It is much more simple then chmod.
First argument is the user.group. The next arguments are the files to change. It is that simple.
The green color you are referring is subjective to the person who put your Linux distribution together, and has no fixed meaning in the Linux world. However buy normal usage conventions it is normally associated with executable files. In the comment above Ignacio was asking you to look deeper. Example:
What do you see? If you look on the left side there are three sets of permissions. In this case the user root can execute, read and write, members of the group root can read and execute and everyone else can read and execute. The first dash on the far left is for special permissions, directories and symbolic links.
So how do you change this? There are two basic ways, both involving the command chmod (change mode). You could chmod u+x file to allow the owner execute permissions to the file, or you could do chmod a+x to allow everyone including the owner and group execute permissions or you could do chmod 550 to give the owner and group read and execute permissions.
Wikipedia has a great article discussing chmod in general along with basic file permissions.