DATA 전문가로 가는 길

[Unix/Linux] Cygwin Open SSH 설치 및 서비스 등록 본문

OS/Fundamental

[Unix/Linux] Cygwin Open SSH 설치 및 서비스 등록

EstenPark 2009. 6. 30. 10:26


1. 소스 설치 방법

Net-SNMP 사이트에서 다운 받을 수 있습니다.

다운 받으신 후 압축을 해제 하시면 디렉토리 안에 많은 파일들이 있습니다.
컴파일 하기 위해서 필요한 요소들입니다.

설치를 시작 하기 전에 꼭 보셔야 할 것이 README.win32  문서가 있습니다.
그중에 Cygwin으로 세팅하는 방법은 아래와 같습니다.

 ***************************************************************************
*
* Cygwin - Building
*
***************************************************************************

An alternate way to build Net-SNMP for win32 is to use Cygnus's cygwin32
environment.  Information on the Cygnus cygwin32 environment is available
on the web at: http://sources.redhat.com/cygwin/.

Cygwin allows you to compile almost the complete agent and applications.
The following configure options creates a working set of programs:

./configure \
  --with-mib-modules="host agentx disman/event-mib examples/example" \
  --with-out-mib-modules=host/hr_network --with-libs="-lws2_32" \
        --disable-embedded-perl --without-perl-modules \

If you want to use SNMPv3 auth and privacy features, add:
  --with-openssl="/usr" \

If you want to use IPv6 transports, add:
  --enable-ipv6 --with-transports="TCPIPv6 UDPIPv6"

Note:  The source code should *not* be in a folder that contains a space.  For
       example, compiling in your 'My Documents' or your Desktop (usually
       c:\Documents and Settings\xxxx\Desktop) is not supported.

This has been tested for Windows 98 and Windows NT 4.0.  In order for
the process part of the host resources MIB to work under NT you will need
to get hold of the PSAPI.DLL. This available under the download section
of www.microsoft.com.  The DLL is included with Windows 2000 and XP,
and is also part of the VC++ distribution.  The IPHLPAPI library is
part of the "Microsoft Platform SDK", which is also available from
www.microsoft.com.  See the section "Installing Platform SDK" for details.

Earlier releases of Cygwin may need to use the configure flag
  --with-libs="-lregex -libphlpapi"
but this regular expression support has since been incorporated
into the main Cygwin package, and it is no longer necessary to
include it separately.

If the folder that Net-SNMP was installed to is ever changed, modify the
system environment variables or registry keys as explained in the
'Configuration_Overview.html' file located in win32/dist/htmlhelp.


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


2. Cygwin 명령어를 활용( ssh-host-config )

http://pigtail.net/LRP/printsrv/cygwin-sshd.html
문서를 확인 해보면 Cygwin 을 설치해서 기본적인 설정 후에 서비스를 등록 하면 모두 끝납니다.

 1. Cygwin 에서 Openssh를 설치 한다.


2. 내컴퓨터->속성->고급->환경변수->시스템 변수에서 CYGWIN=ntsec을 설정한다. "ntsec"은 Cygwin이 Windows의 보안 규칙을 사용해서 파일 등의 접근 권한을 설정함을 의미합니다.


3. 기본 권한 부여
chmod +r  /etc/passwd
chmod +r  /etc/group
chmod  755  /var , chmod -R 755 /var

4. openssh 설치

ssh-host-config
------------------------------------------------------------------------------------------------------
*** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes
*** Info: Creating default /etc/ssh_config file
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.
*** Query: Should privilege separation be used? (yes/no) yes
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges.  Should this script attempt to create a
*** Query: new local account 'sshd'? (yes/no) yes
*** Info: Updating /etc/sshd_config file
*** Info: Added ssh to C:\WINDOWS\system32\driversc\services


*** Warning: The following functions require administrator privileges!

*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
*** Info: Note that the CYGWIN variable must contain at least "ntsec"
*** Info: for sshd to be able to change user context without password.
*** Query: Enter the value of CYGWIN for the daemon: [ntsec] CYGWIN=ntsec

*** Info: The sshd service has been installed under the LocalSystem
*** Info: account (also known as SYSTEM). To start the service now, call
*** Info: `net start sshd' or `cygrunsrv -S sshd'.  Otherwise, it
*** Info: will start automatically after the next reboot.

*** Info: Host configuration finished. Have fun!

ucesspay@UCESSPAY /
$ cygrunsrv -S sshd
*** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes
*** Info: Creating default /etc/ssh_config file
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.
*** Query: Should privilege separation be used? (yes/no) yes
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges.  Should this script attempt to create a
*** Query: new local account 'sshd'? (yes/no) yes
*** Info: Updating /etc/sshd_config file
*** Info: Added ssh to C:\WINDOWS\system32\driversc\services


*** Warning: The following functions require administrator privileges!

*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
*** Info: Note that the CYGWIN variable must contain at least "ntsec"
*** Info: for sshd to be able to change user context without password.
*** Query: Enter the value of CYGWIN for the daemon: [ntsec] CYGWIN=ntsec

*** Info: The sshd service has been installed under the LocalSystem
*** Info: account (also known as SYSTEM). To start the service now, call
*** Info: `net start sshd' or `cygrunsrv -S sshd'.  Otherwise, it
*** Info: will start automatically after the next reboot.

*** Info: Host configuration finished. Have fun!

------------------------------------------------------------------------------------------------------
5. 서비스 등록
등록 및 자동시작 : cygrunsrv -S sshd
중지 : cygrunsrv -E sshd
제거 : cygrunsrv -R sshd

6. 포트 변경 방법 ( 데몬 다운시킨 후 작업 )

 vi /bin/ssh-host-config
------------------------------------------------------------------------------------------------------
#!/bin/bash
#
# ssh-host-config, Copyright 2000, 2001, 2002, 2003 Red Hat Inc.
#
# This file is part of the Cygwin port of OpenSSH.

# ==========================================================
# Initialization
# ===========================
..
..

port_number=1001
------------------------------------------------------------------------------------------------------


 ssh-host-config
------------------------------------------------------------------------------------------------------
*** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes
*** Info: Creating default /etc/ssh_config file
*** Info: Updating /etc/ssh_config file with requested port
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.
*** Query: Should privilege separation be used? (yes/no) yes
*** Info: Updating /etc/sshd_config file

*** Info: Host configuration finished. Have fun!
------------------------------------------------------------------------------------------------------

7. 윈도우 계정 패스워드 사용 하기

mkpasswd   -cl   >   /etc/passwd
mkgroup   --local    >   /etc/group


Comments