|
1 -*- mode: outline; coding: utf-8 -*- |
|
2 |
|
3 * ssh. |
|
4 |
|
5 ** ssh server on cygwin. |
|
6 |
|
7 * Инсталлируем стандартный набор утилит Cygwin + пакет openssh. |
|
8 * Устанавливаем переменную окружения CYGWIN=binmode tty ntsec. |
|
9 Это можно сделать глобально или через cygwin.bat (только для клиента). |
|
10 set CYGWIN=binmode tty ntsec |
|
11 * Создать пользователя (XXX как сделать чтобы этот пользователь не мог логиниться?), |
|
12 например с именем user. |
|
13 * Обновить /etc/passwd |
|
14 $ mkpasswd -l -u user >>/etc/passwd |
|
15 или |
|
16 $ mkpasswd -l >/etc/passwd |
|
17 для обносления всех записей. |
|
18 * В приглашении bash: |
|
19 $ mkdir -p /home/user |
|
20 $ ssh-host-config -y |
|
21 Стартуем сервер: |
|
22 $ net start sshd |
|
23 или |
|
24 $ cygrunsrv -S sshd |
|
25 * На удаленной машине логинимся: |
|
26 $ ssh 192.168.1.26 -l user |
|
27 * Остановить сервер |
|
28 $ cygrunsrv -E sshd |
|
29 |
|
30 *** Запускаем SSH server на правах произвольного пользователя. |
|
31 |
|
32 * Создаем пользователя, например с именем user, задаем ему пароль, |
|
33 права (т.е. в какие группы будет входить) и т.д., пользователя не блокируем. |
|
34 * В консоле MMC добавляем оснастку "Параметры безопасности.". Модифицируем параметры: |
|
35 |
|
36 "Параметры безопасности."->"Локальные политики."->"Назначение прав пользователя." |
|
37 ->"Вход в качестве службы."->добавить 'user'. |
|
38 |
|
39 "Параметры безопасности."->"Локальные политики."->"Назначение прав пользователя." |
|
40 ->"Отклонить локальный вход."->удалить 'user' (если был установлен). |
|
41 |
|
42 XXX "Принудительное удаленнон завершение." |
|
43 |
|
44 ** ssh client. |
|
45 |
|
46 *** SSH client on Windows. |
|
47 |
|
48 **** ssh from Cygwin. |
|
49 |
|
50 * Инсталируем openssh из Cygwin. |
|
51 * В приглашении bash набираем |
|
52 $ ssh user@192.168.1.38 |
|
53 или |
|
54 $ ssh -l user 192.168.1.38 |
|
55 |
|
56 ** Reverse SSH Tunneling |
|
57 |
|
58 Have you ever wanted to ssh to your Linux box that sits behind NAT? Now you can with |
|
59 reverse SSH tunneling. This document will show you step by step how to set up reverse SSH |
|
60 tunneling. The reverse SSH tunneling should work fine with Unix like systems. |
|
61 |
|
62 Let's assume that Destination's IP is 192.168.20.55 (Linux box that you want to access). |
|
63 |
|
64 You want to access from Linux client with IP 138.47.99.99. |
|
65 Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99) |
|
66 |
|
67 SH from the destination to the source (with public ip) using command below: |
|
68 |
|
69 $ ssh -R 19999:localhost:22 sourceuser@138.47.99.99 |
|
70 |
|
71 port 19999 can be any unused port. |
|
72 Now you can SSH from source to destination through SSH tuneling: |
|
73 |
|
74 $ ssh localhost -p 19999 |
|
75 |
|
76 3rd party servers can also access 192.168.20.55 through Destination (138.47.99.99). |
|
77 Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99) <- Bob's server |
|
78 |
|
79 From Bob's server: |
|
80 |
|
81 $ ssh sourceuser@138.47.99.99 |
|
82 |
|
83 After the sucessful login to Source: |
|
84 |
|
85 $ ssh localhost -p 19999 |
|
86 |
|
87 The connection between destination and source must be alive at all time. Tip: you may run |
|
88 a command (e.g. watch, top) on Destination to keep the connection active. |