Installing Cygwin unattended on W2K8

Installing Cygwin unattended on W2K8

Unattended Install

Unattended Cygwin+Openssh+Some Utils Installation for Windows


1 Download setup.exe from the cygwin web site.

2 Run the installer conventionally, choosing the options for downloading to a local directory without installing anything. Make sure you have the following packege choose:

From Admin, select all packages.
From Archive, select unzip and zip packages.
From Base, leave the default, select all packages.
From Doc, leave the default, man and 'cygwin doc' packages.
From Editors, select vim package.
From Net, select openssh (openssl will get checked automatically), rsync and tcp_wrappers packages.

set to 'Install' in the choose packages page.

3 Run the sed script over the downloaded setup.ini file: (Note: Need a Cygwin installed machine to performe this)
cp setup.ini setup.ini-backup 
sed "s/[cC]ategory:.*/Category: Base/" < setup.ini > setup.temp
cp setup.temp setup.ini

4 This now leaves you with a 'canned' version of Cygwin that will install from the command line as follows:

setup.exe -q --local-install --root c:\where\you\want\to\put\cygwin -l c:\path\to\installer\directory

Note: that the paths you give to setup.exe need to be Windows paths, not Cygwin paths.

"c:\where\you\want\to\put\cygwin" means the cygwin will be installed in to this folder eg. c:\ssh

"c:\path\to\installer\directory" means the package downloaded from Internet. The original directory name is something like "http%3a%2f%2fmirror.csclub.uwaterloo.ca%2fcygwin%2f" rename it and point the install batch file to the realname. eg. c:\ssh\package\release.

4. Right click My Computer, Properties, Advanced, Environment Variables
Click the "New" button to add a new entry to System variables:
variable name is CYGWIN
variable value is ntsec tty

or use this commad: setx CYGWIN "ntsec tty" /m

5. Right click My Computer, Properties, Advanced, Environment Variables
Select the Path variable and click the "Edit" button:
append ;c:\cygwin\bin to the end of the existing variable string.

or use this command: SET PATH = %PATH%;C:\ssh\bin

How to uninstall/install cygwin under Windows 2008

6. Uninstall Steps

(From previous attempted failed installations)

In Administrator shell

1. net stop sshd

2. cygrunsrv -R sshd

3. net user

Delete any user listed like sshd or sshd_server. 

The following syntax is to be used:

net user sshd /DELETE

4. rm -R /etc/ssh*

5. mkpasswd -cl > /etc/passwd

6. mkgroup --local > /etc/group

In User shell

1. cd ~

2. rm -R .ssh

***********************************************

7. Installation Steps

In Administrator shell

1. ssh-host-config -y

2. net start sshd

In User shell

1. ssh-user-config (Answer questions as appropriate to your situation)

2. Test connection:

ssh -vvv localhost

Then go to Control Panel ... Windows Firewall, open inbound TCP port 22.

8. Troubleshooting…

1 SSH-Issue: /bin/bash: Permission denied

Going to cygwin icon from desktop and add

mkpasswd -l > /etc/passwd

mkgroup -l > /etc/group

Then add these 6 commands as work around:

chmod +r /etc/passwd
chmod u+w /etc/passwd
chmod +r /etc/group
chmod u+w /etc/group
chmod 755 /var
chmod 664 /var/log/sshd.log

Then run this command

editrights -a SeTcbPrivilege -u ssh_service
editrights -a SeAssignPrimaryTokenPrivilege -u ssh_service
editrights -a SeCreateTokenPrivilege -u ssh_service
editrights -a SeDenyInteractiveLogonRight -u ssh_service
editrights -a SeDenyNetworkLogonRight -u ssh_service
editrights -a SeDenyRemoteInteractiveLogonRight -u ssh_service
editrights -a SeIncreaseQuotaPrivilege -u ssh_service
editrights -a SeServiceLogonRight -u ssh_service

finally,

net stop sshd

net start sshd

2 SSH-Issue: Server refused to allocate pty

Check task manager to see how many bash.exe were running, then issue the following command to kill them all

Taskkill /F /IM bash.exe /T

Taskkill.exe is located in C:\WINDOWS\system32

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章