使用PowerShell自动化Cygwin配置

时间:2014-06-27 06:57:05

标签: powershell cygwin

我使用PowerShell脚本安装了Cygwin。

我手动执行以下步骤:

  1. 运行新的cygwin bash shell(编辑cygwin.bat后)并输入:

    mount --change-cygdrive-prefix /
    chmod +r /etc/passwd /etc/group
    chmod 755 /var
    
  2. 启动Cygwin bash shell并运行ssh-host-config。对所有关键代问题回答“是”。

  3. 是否可以在PowerShell脚本中自动执行这些操作,例如安装Cygwin,然后一次执行第1步和第2步?

1 个答案:

答案 0 :(得分:3)

使用此命令:

bash.exe ssh-host-config --yes -u "Cygwinuser" -c "binmode ntsec tty" -w "pwd@123"
cygrunsrv -S sshd

稍后转到services.msc以检查服务是否正在运行