Cygwin なんでも掲示板

一覧最新記事過去一覧 | 検索FAQアンテナHOME
(新規投稿・発言はできません)


スレッド

└◇2590:
OpenSSH... [Chi] 11/24 00:24

 ├◇2591:Re:OpenSSH... [MSだす。] 11/24
 └◇2592:Re:OpenSSH... [k-squar] 11/25
  └◇2597:Re[2]:OpenSSH... [Chi] 11/27
   ├◇2598:あと・・・ [Chi] 11/27
   └◇2599:Re[3]:OpenSSH... [MSだす。] 11/27
    └◇2604:Re[4]:OpenSSH... [Chi] 11/29 <


2590● OpenSSH...[ Chi ] 2004 11/24 00:24
こんにちは、初めての投稿です・・・・・

VNCを安全にするためにOpensshを導入しようと
思っているのですが、どうしても
動きません。サービスとして登録はできたのですが、


Which value should the environment variable CYGWIN have when
sshd starts? It's recommended to set at least "ntsec" to be
able to change user context without password.
Default is "ntsec". CYGWIN=tty

ここでttyとだけ答えたのがまずかったのか。

どうしても
$ ssh localhost
Enter passphrase for key '/home/user_name/.ssh/id_rsa':パスフレーズを入れても
Connection to localhost closed.

となってしまいます。
後で環境変数をいじくってもだめでした。
最初からやりなおすにはどうしたら・・・・。


環境はWindows XP Home Edition Service Pack 1
$ cygcheck -c cygwin openssh openssl zlib cygrunsrv ash gawk
Cygwin Package Information
Package Version Status
ash 20040127-1 OK
cygrunsrv 1.0-1 OK
cygwin 1.5.10-3 OK
gawk 3.1.4-3 OK
openssh 3.9p1-1 OK
openssl 0.9.7d-1 OK
zlib 1.2.1-1 OK

$ cygrunsrv -Q sshd
Service sshd exists
Type : Own Process
Current State : Running
Controls Accepted : Accept Stop

参考書
アスキー社Cygwin+Cygwin JE-Windowsで動かすUNIX環境
ディー・アート社Windows上で実現されるUNIX環境 Cygwinを使おう

これらの本を見る限り、環境変数CYGWINにntsecの設定が必要とか書いてありますが、デフォルトで設定されているのでその必要はないとも書かれています。(どっちなんだ〜)

参考サイト
http://www.ece.utexas.edu/~luo/tightvnc_ssh.html
openssh導入したいと思ったきっかけ
http://shooting-star.myhome.cx/cygwin/openssh.html
これを見る限り、アクセス権限の設定を変えなければ
いけないのか。
そうだとしても、制限を厳しくすればいいのか、緩めれば
いいのか
わからないです。関係のファイルがいっぱいあるし、
cygwinのバージョンでも
違ってくるとか。
http://osksn2.hep.sci.osaka-u.ac.jp/~naga/miscellaneous/winssha-4.html

わからないよう。
2ちゃんねるによると、
<<sshのばやいは
ssh -v localhost
sshdのばやいは
sshd -d

とりあえず、/var/emptyのパーミッションかえれ。>>
と書いてあったのですが、表示されるログの意味が
そもそも分からないんです(涙)。

どなたか、お知恵を拝借できたら幸いです。
スレッド一覧


2591● Re:OpenSSH...[ MSだす。 ] 2004 11/24 05:49
> Which value should the environment variable CYGWIN
>have when sshd starts? It's recommended to set at
>least "ntsec" to be able to change user context
>without password. Default is "ntsec". CYGWIN=tty
>
> ここでttyとだけ答えたのがまずかったのか。
>
> どうしても
> $ ssh localhost
> Enter passphrase for key
'/home/user_name/.ssh/id_rsa':パスフレーズを入れても
> Connection to localhost closed.
>
> となってしまいます。
> 後で環境変数をいじくってもだめでした。
> 最初からやりなおすにはどうしたら・・・・。
>
ssh-host-config
をもういちど実行してCYGWIN=ntsecと設定すれば上手くいき
ませんか?
それでだめなら、
rm /etc/ssh*
してから
ssh-host-config

それでもだめなら、opensshを一度uninstallしてから入れな
おす…、とか。
スレッド一覧


2592● Re:OpenSSH...[ k-square ] 2004 11/25 01:27
ども referer から飛んできました☆

とりあえず、サービスをとめて、
$ /usr/sbin/sshd -d
で sshd を起動して、
別の cygwin コンソールから、
$ ssh -v localhost
で、二つ分の表示メッセージを張りつけると良いかもしれません。

それとは別に、もしかしたらの解法ですが、
CYGWIN 環境変数は sshd の場合は明示的に設定するので、
デフォルト設定を上書きされる気がします。
ので、ssh サービスをとめ、
ssh-host-config を再度実施して、
CYGWIN 環境変数を上書きしてみてください。
その後、~/.ssh/known_hosts ファイルを消してから、
再度 localhost にアクセスしてみてください。

↓簡単にやってみたこと

[admin@hostname] ~
$ echo $CYGWIN
ntsec nosmbntsec tty

[admin@hostname] ~
$ ssh localhost
Enter passphrase for key '/home/admin/.ssh/id_rsa':
Fanfare!!!
You are successfully logged in to this server!!!

[admin@hostname] ~
$ echo $CYGWIN
binmode ntsec nosmbntsec tty

http://shooting-star.myhome.cx

スレッド一覧


2597● Re[2]:OpenSSH...[ Chi ] 2004 11/27 14:10
お返事遅れました。

お二人のアドヴァイスを一緒にしたのが良くなかったのか・・・・。
sshd、起動しなくなっちゃいました(涙)。
MSだすさん。解決法1。
>ssh-host-config
>をもういちど実行してCYGWIN=ntsecと設定すれば上手くいき
>ませんか?

もう一度トライ。
$ ssh-host-config
Overwrite existing /etc/ssh_config file? (yes/no) yes
Generating /etc/ssh_config file
Overwrite existing /etc/sshd_config file? (yes/no) yes
Privilege separation is set to yes by default since OpenSSH 3.3.
However, this requires a non-privileged account called 'sshd'.
For more info on privilege separation read /usr/share/doc/openssh/README.privsep.

Should privilege separation be used? (yes/no) yes
Generating /etc/sshd_config file

Host configuration finished. Have fun!

となってだめです。(環境変数の話が出てきません。)

k-squareさん。
>とりあえず、サービスをとめて、
>$ /usr/sbin/sshd -d
>で sshd を起動して、
>別の cygwin コンソールから、
>$ ssh -v localhost
>で、二つ分の表示メッセージを張りつけると良いかもしれません。


$ /usr/sbin/sshd -d
debug1: sshd version OpenSSH_3.9p1
Could not load host key: /etc/ssh_host_key
Could not load host key: /etc/ssh_host_rsa_key
Could not load host key: /etc/ssh_host_dsa_key
Disabling protocol version 1. Could not load host key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.

$ ssh -v localhost
OpenSSH_3.9p1, OpenSSL 0.9.7d 17 Mar 2004
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
ssh: connect to host localhost port 22: Connection refused

なんか権限の問題っぽいですが、ポートの問題にも思えます。
本にはsetfaclで/var/runとvar/logのパーミッション
だけ変えれば良いと
書いてありましたが、それだけじゃだめなのかなあ。


http://shooting-star.myhome.cx/cygwin/openssh.html
このページのとおりにするのなら、
ファイル権限をほとんど変えないと。
それらは全てchmodでいいんでしょうか?

$ echo $CYGWIN
server ntsec binmode tty
この表示でいいんでしょうか?
serverはpostgresql+cygserverに必要な設定なんですが。


>それとは別に、もしかしたらの解法ですが、
>CYGWIN 環境変数は sshd の場合は明示的に設定するので、
>デフォルト設定を上書きされる気がします。
>ので、ssh サービスをとめ、
>ssh-host-config を再度実施して、
>CYGWIN 環境変数を上書きしてみてください。
>その後、~/.ssh/known_hosts ファイルを消してから、
>再度 localhost にアクセスしてみてください。

$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
RSA key fingerprint is ---------.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
Enter passphrase for key '/home/user_name/.ssh/id_rsa':
Connection to localhost closed.
となってしまいます。環境変数には変化ありません。

MSだすさん、解決法2。

$ rm /etc/ssh*
rm: remove write-protected file `/etc/ssh_host_dsa_key'? yes
rm: remove write-protected file `/etc/ssh_host_dsa_key.pub'? yes
rm: remove write-protected file `/etc/ssh_host_key'? yes
rm: remove write-protected file `/etc/ssh_host_key.pub'? yes
rm: remove write-protected file `/etc/ssh_host_rsa_key'? yes
rm: remove write-protected file `/etc/ssh_host_rsa_key.pub'? yes

$ /usr/bin/ssh-host-config
Generating /etc/ssh_host_key
Generating /etc/ssh_host_rsa_key
Generating /etc/ssh_host_dsa_key
Generating /etc/ssh_config file
Privilege separation is set to yes by default since OpenSSH 3.3.
However, this requires a non-privileged account called 'sshd'.
For more info on privilege separation read /usr/share/doc/openssh/README.privsep.

Should privilege separation be used? (yes/no) yes
Generating /etc/sshd_config file

Host configuration finished. Have fun!

$ net start sshd
CYGWIN sshd サービスを開始します.
CYGWIN sshd サービスを開始できませんでした。

システム エラーが発生しました。

システム エラー 1067 が発生しました。

プロセスを途中で強制終了しました。

unya-----。

MSだすさん、解決法3(もう一度入れ直す)。
その気力がわいてからトライします(涙)。
スレッド一覧


2598● あと・・・[ Chi ] 2004 11/27 14:19
最新のデバッグ結果です。

$ /usr/sbin/sshd -d
debug1: sshd version OpenSSH_3.9p1
debug1: private host key: #0 type 0 RSA1
debug1: read PEM private key done: type RSA
debug1: private host key: #1 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #2 type 2 DSA
/var/empty must be owned by root and not group or world-writable.
スレッド一覧


2599● Re[3]:OpenSSH...[ MSだす。 ] 2004 11/27 17:31
>…(略)…
>となってだめです。(環境変数の話が出てきません。)
cygrunsrv -R sshd
で一度サービスから削除した後、
ssh-host-config
すると、サービスとしてインストールするか聞いてくるのでは
ないかと思います(/bin/ssh-host-configを読むとそうなっているように見えます)。そのとき環境変数についても聞いてくるのでしょう。
スレッド一覧


2604● Re[4]:OpenSSH...[ Chi ] 2004 11/29 22:49
やっとのことでsetfaclとgetfaclの使い方がつかめたし、varの三つのディレクトリ
の属性を変えることに成功しましたが、
それでもつながりません。

http://shooting-star.myhome.cx/cygwin/openssh.html
/etc/ssh*やクライアントの/Home/user_name/.sshの権限もsetfaclで設定しなおさな
ければならないのでしょうか。今のところ:
/etc
-rwxr-x--- 1 SYSTEM なし 1159 Nov 28 16:10 ssh_config*
-rw------- 1 SYSTEM なし 668 Nov 28 16:10 ssh_host_dsa_key
-rw-r--r-- 1 SYSTEM なし 614 Nov 28 16:10 ssh_host_dsa_key.pub
-rw------- 1 SYSTEM なし 539 Nov 28 16:10 ssh_host_key
-rw-r--r-- 1 SYSTEM なし 343 Nov 28 16:10 ssh_host_key.pub
-rw------- 1 SYSTEM なし 887 Nov 28 16:10 ssh_host_rsa_key
-rw-r--r-- 1 SYSTEM なし 234 Nov 28 16:10 ssh_host_rsa_key.pub
-rw-r--r-- 1 SYSTEM なし 2807 Nov 28 16:10 sshd_config

/.ssh
$ ls -al
total 6
drwx------+ 2 user_name なし 0 Nov 28 17:21 ./
drwxr-xr-x+ 4 user_name なし 0 Nov 7 17:01 ../
-rw-------+ 1 user_name なし 848 Nov 7 17:33 authorized_keys
-rw------- 1 user_name なし 736 Nov 7 17:33 id_dsa
-rw-r--r-- 1 user_name なし 614 Nov 7 17:33 id_dsa.pub
-rw------- 1 user_name なし 963 Nov 7 17:32 id_rsa
-rw-r--r-- 1 user_name なし 234 Nov 7 17:32 id_rsa.pub
-rw-r--r-- 1 user_name なし 220 Nov 28 17:21 known_hosts



何度かやり直したのですが、やり直しのどの段階でssh-host-configやssh-client-configで権限が書き換えられているのかまだつかめていません。
スレッド一覧

早田のホームページへ
CGIROOM