Please let me know a MSYS shell command that can be used for changing the attributes of a file. When I ran a command as ls -l
I got the following :
-rw-r--r-- 1 lenovo Admin .....m4sugar.m4
I want to provide full access rights.
Any help is highly appreciated.
Thanks
The problem is very likely one of the minimal implementation in MSYS tools. You would also be restricted from making changes you cannot change with a Windows tool like attrib.exe.
As you can see, chmod works fine. Now, see what happens with attrib.exe, a Windows binary:
attrib, the Windows tool, is agnostic about the ugoa permissions and simplifies things down to having or not having rights:
I'm note sure its fair to expect an MSYS tool to do more than the Windows "equivalent". The M in MSYS means "Minimal".
cacls.exe can do some things under MSYS. For instance, this says I and Administrators have full control even though
ls -l
appears to say Administrat doesn't have write. Be careful. If on Windows, perhaps use Windows methods. $ cacls testC:\msys\1.0\home\kbulgrien\test BUILTIN\Administrators:F NT AUTHORITY\SYSTEM:F APD\kbulgrien:F BUILTIN\Users:R
The following command is one I use in an MSYS environment to fix permissions on SQL database files after I restore from archive. You can run Windows binaries from MSYS. I do it all the time... for instance, scripts run diskpart, format, etc. in an MSYS shell without invoking cmd.exe.
@cdhowie is right; this is a bug of msys tracked there -> http://sourceforge.net/tracker/?func=detail&atid=102435&aid=3071537&group_id=2435
@kbulgrien gives the good approach to change the permissions:
cacls
: http://ss64.com/nt/cacls.html, oricacls
: http://ss64.com/nt/icacls.htmlNote:
icacls
is the new version ofcacls
correcting several issues but seems to be not present in Windows XP.You can use either of the following commands to give full access rights to Everyone:
cacls "$file_path" //E //P Everyone:F
icacls "$file_path" //grant Everyone:F
Note that
ls -l
in Msys won't display accurate information on real ACLs after the usage ofcacls
oricacls
.