Notice
Recent Posts
Recent Comments
Link
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Archives
Today
Total
관리 메뉴

Astro Coke

[Cygwin] Installing CYGWIN + SSHD for remote access through SSH on windows 본문

Computer Setup

[Cygwin] Installing CYGWIN + SSHD for remote access through SSH on windows

astrodoo 2019. 5. 4. 09:34

source: https://gist.github.com/roxlu/5038729


1) 우선은 cygwin set-up 실행파일을 통해 openssh 와 cygrunsrv 패키지를 설치해야한다.

 

2) Configure SSHD
- open a cygwin terminal: start > RIGHT MOUSE ON "Cygwin terminal" AND "RUN AS ADMINISTRATOR"
- $ ssh-host-config
- Are you sure you want to continue: YES
- You have the required privileges: YES
- Overwrite existing /etc/ssh_config: YES
- Should privilege separation be used: YES
- Use local account 'sshd': YES
- Do you want to install 'sshd' as a service: YES
- name CYGWIN: just press enter
- Do you want to use a different name: no
+++ you can skip this ++
- Create new privileged user account (cyg_server): YES
- enter password
- reenter password
+++ end of skip ++

3) Add a SSHD account
- Open control panel
- Create a new account with administrator rights
- set a password for this new account

4) Add the user to SSHD password
$ cd /etc/
$ cp passwd passwd_bak
$ /bin/mkpasswd.exe -l -u [new_username] >> /etc/passwd
(for example: /bin/mkpasswd.exe -l -u roxlu >> /etc/passwd to add the password for roxlu)

5) Open SSHD port (22)
- Open control panel
- Control Panel > Windows Defender Firewall
- 왼쪽 리스트의 Advanced settings 를 클릭한다.
- click: select "Inbound Rules"
- click: New Rule ...
- [x] Port
NEXT
- TCP
Specific ports: 22
NEXT
- [x] Allow the connection
NEXT
- [x] Domain
[x] Private
[x] Public
NEXT

6) Trouble shooting
- first check if you can connect to the SSHD server on the same machine:
- open a Cygwin terminal

$ cygrunsrv -S sshd
$ ssh -l [username] localhost
If you can't connect to the server on localhost check if the sshd daemon is running (see blow)
- check if the SSHD daemon is runing
- open control panel
- search for "services"
- click on "View local services"
- search for "CYGWIN sshd"
- make sure it's there, else try reinstalling sshd

7) Access from remote computer
 - open ssh and connect with [new_username], which was created in step 4
    e.g.) ssh -l new_username@your_windows_server_ip