Zhao Yi wrote:
When my ruby runs an external program, it will get this warning:
warning: Insecure world writable dir SOMEDIR
I have checked the SOMEDIR and its permission mode is 777. Does anyone
know this warning? How can I avoid this?
thanks
I understand that you want this directory to be world-writable, so this is probably not much use for your current situation, but handy to know nonetheless. You may want to configure a group, see /etc/groups, man groups, or man chgrp instead of having it be world-writable.
With that aside, there are two ways to modify the permissions for files and directories. In essence, it's by name or by number. Using the names is better when beginning. See man chmod for more details.
Basically, you can use the syntax 'chmod <which_access_level><+ or -><which_access_type>'.
<which_access_level> would be one of the following {a,u,g,o} where a is all (user group and other), u is user, g is group, and o is other (typically everyone else).
<+ or -> is a boolean true or false for turning on or off the permission.
<which_access_type> would be {r,w,x} where r is read, w is write, and x is execute.
So for example, if you wanted to remove the read ability for everyone except the user and group, you would use:
chmod o-r test-file.txt
You can group them as well, so the following is valid for adding write ability for the user and group:
chmod ug+r test-file.txt
The a for access level is a shortcut for all three. So to remove all types ability to execute a file:
chmod a-x test-file.txt
Also, you will probably want to check into man chown for how to change the user attribute for a specific file or set.
Hope that helps.
Best regards,
Ryan Masters
End Point Corp.
ryan@endpoint.com