質問編集履歴

2

コードの追記

2016/07/20 15:05

投稿

dore
dore

スコア26

test CHANGED
File without changes
test CHANGED
@@ -39,3 +39,109 @@
39
39
 
40
40
 
41
41
  最終的にはphpファイルを起動しmysqlから値を取り出したいです。サーバの都合上、直にmysqlには接続できません。
42
+
43
+
44
+
45
+
46
+
47
+ 追記
48
+
49
+
50
+
51
+ using System;
52
+
53
+ using System.Collections.Generic;
54
+
55
+ using System.Linq;
56
+
57
+ using System.Text;
58
+
59
+ using System.Threading.Tasks;
60
+
61
+ using Tamir.SharpSsh;
62
+
63
+ using Tamir.SharpSsh.jsch;
64
+
65
+
66
+
67
+ namespace ********
68
+
69
+ {
70
+
71
+ class ********
72
+
73
+ {
74
+
75
+
76
+
77
+ public string executeCommand(string **ユーザネーム.sakura.ne.jp**
78
+
79
+ , string **ユーザネーム**
80
+
81
+ , string **サーバに入るパスワード**
82
+
83
+ , string **シェルコマンドの文字列**
84
+
85
+ , int **tcpポートの番号(22を入れています)**)
86
+
87
+ {
88
+
89
+ SshExec ssh = new SshExec(**ユーザネーム.sakura.ne.jp**
90
+
91
+ , **ユーザネーム**
92
+
93
+ , **サーバに入るパスワード**);
94
+
95
+ string result = null;
96
+
97
+ //文字列に当たる箇所は""で囲むもしくはstring変数です
98
+
99
+ try
100
+
101
+ {
102
+
103
+ ssh.Connect(**22**);
104
+
105
+ result = ssh.RunCommand(**シェルコマンドの文字列**);
106
+
107
+ }
108
+
109
+ catch (Exception ex)
110
+
111
+ {
112
+
113
+ result = ex.Message;
114
+
115
+ }
116
+
117
+ finally
118
+
119
+ {
120
+
121
+ if (null != ssh)
122
+
123
+ {
124
+
125
+ ssh.Close();
126
+
127
+ }
128
+
129
+ }
130
+
131
+
132
+
133
+ return result;
134
+
135
+ }
136
+
137
+
138
+
139
+
140
+
141
+ }
142
+
143
+ }
144
+
145
+
146
+
147
+ コードの内容は上記のようなものでした。

1

タイトルの変更

2016/07/20 15:04

投稿

dore
dore

スコア26

test CHANGED
@@ -1 +1 @@
1
- サーバログイン時におこるAlgorithm negotiation fail対策
1
+ C# SharpSshのエラーの解決法
test CHANGED
File without changes