12

Is there a way to run the chmod command on Windows?

Techboy
  • 1,550
  • 7
  • 31
  • 49

9 Answers9

10

No, there's no chmod command in Windows.

Either use Explorer's properties page for the file, or from a command shell use the attrib or cacls commands.

Alnitak
  • 21,191
  • 3
  • 52
  • 82
5

Installing Cygwin provides a chmod command utility.

Ray
  • 720
  • 1
  • 9
  • 13
  • I just add c:\cygwin (assuming that is your install directory) to the environmental variables in Control Panel, System, Advanced, Environmental Variables, PATH – Sun Aug 13 '14 at 22:12
2

I was going throu the net to get the exact syntax for the same: Found a few HEre is the icacls.exe alternative to chmod 400

Step1: icacls.exe "path+key.pem" /reset

Step2: icacls.exe "path+key.pem" /grant:r "$($env:username):(r)"

Step3: icacls.exe "path+key.pem" /inheritance:r

Icacls alternative for chmod in Windows

2

Exactly what do you want to accomplish by using chmod?
Would you be marking some files as executable?
Windows system does not support most (all?) of what chmod is used to do.

You can change read-only and visibility access recursively from the explorer properties.


I was surprised to see CHMOD-Win
But, do be careful with what you get from such sites.

nik
  • 7,100
  • 2
  • 25
  • 30
  • Thanks I did try CHMOD-Win, but that just gives you the numerical values for the file permissions you want to apply to each user group (e.g. 4 = read, etc.). – Techboy Aug 10 '09 at 09:00
  • 1
    In that case you should try the properties from the GUI or the `attrib` command (try "attrib /h" from a command shell). – nik Aug 10 '09 at 09:02
  • Thanks for the help. As it is not possible to run chmod from within Windows, I have asked a separate question (explaining my issue in full) here: http://serverfault.com/questions/52162/windows-file-permissions-comparing-to-chmod – Techboy Aug 10 '09 at 09:20
2

There are some native Win32 ports of Unix commands available. I believe chmod is included, but depending on what you're actually trying to accomplish this might be the wrong tool to use. Perhaps CACLS could be useful (try "cacls" from the command line or search in the windows help).

rjnilsson
  • 121
  • 1
  • I have just tried it and chmod doesn't appear to be there (unless I'm doing something wrong). I don't think CACLS will help me in this particular scenario, but thanks. – Techboy Aug 10 '09 at 10:32
  • I just downloaded UnxUtils.zip and chmod is located under usr/local/wbin. – rjnilsson Aug 10 '09 at 10:41
1

In windows 10 powershell I did run the below commands which will be equivalent to chmod

Note: first change the DIR to the folder where you have your .pem file

  1. icacls.exe key.pem /reset
  2. icacls.exe key.pem /grant:r "$($env:username):(r)"
  3. icacls.exe key.pem /inheritance:r
Davidw
  • 1,222
  • 3
  • 14
  • 25
1

On post Win2k OSes one sould use iCalcs instead of the older Calcs.

If you need to set-up website permissions, you can try logging using an FTP client like filezilla and Chmod permissions from there.

olefebvre
  • 472
  • 3
  • 6
1

SUBINACL.EXE

Is a console application for windows that can set file premissions ( NTFS file premissions ), and like metioned before attrib can set some limited file attributes.

EKS
  • 535
  • 1
  • 5
  • 14
0

Download and install git.

Then

Go to the C drive In Program Files folder, you will find the folder named Git, find usr then bin.

In my case, the location for bin folder was:

C:\Program Files\Git\usr\bin Add this location C:\Program Files\Git\usr\bin to path variables, in system environment variables.

Restart cmd.

Try again

Dave M
  • 4,514
  • 22
  • 31
  • 30