linux anaconda powershell提示符中的chmod 400命令引发异常

4ioopgfo  于 2023-06-21  发布在  Linux
关注(0)|答案(1)|浏览(175)

anaconda powershell提示符中的chmod 400命令引发“CommandNotFoundException”
(base)PS C:\Users> chmod 400 keypair1.pem chmod:术语“chmod”不能识别为cmdlet、函数、脚本文件或可操作程序的名称。请检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。在线:1 char:1

  • chmod +r keypair1.pem
+ CategoryInfo          : ObjectNotFound: (chmod:String) [], CommandNotFoundException
  + FullyQualifiedErrorId : CommandNotFoundException
qvtsj1bj

qvtsj1bj1#

chmod command is not available in PowerShell at Window 11.
In Window there is command: [icacls][1] in Window. icacls can do everything that chmod can do in Unix. try command to change mod 400.

Step 1: icacls.exe fileName /reset
Step 2: icacls.exe fileName /grant:r userName:(r)

r -> read only and equivalent: 400
 
  [1]: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/icacls

相关问题