SSH経由でウェブページにアクセスする

SSH経由でウェブページにアクセスする

IEEE xplore にアクセスする必要がありますが、研究所外にダウンロードする権限がありません。

私はSSH経由で研究所のサーバーにログインできます。

では、SSH 経由で研究所のサーバーから IEEE xplore にアクセスするにはどうすればよいでしょうか?

解決策を検索しましたが、いくつかの答えがあります:

ssh -L 8080:localhost:80 user@remoteserver

そして彼はこう言います。

ここで、ローカル ブラウザーを localhost:8080 にポイントします。リモート サーバーの localhost:80 に転送されるはずです。### ただし、ラップトップの設定方法がまだわかりません。Chrome を使用しています。

ご協力に心から感謝いたします!

答え1

最初の方法:

SSHトンネルを起動する

SSH トンネルを開始するには、ターミナルを開き、次のフラグを使用して SSH 経由でリモート サーバーに接続するだけです。

ssh -D 8080 -C -N [email protected]

SSH トンネルで Web を閲覧する (Chrome)

それでは、新しい SSH トンネルを使用して Web の閲覧を開始しましょう。

  • Google Chromeを開く
  • 右上のレンチアイコンを選択します
  • 「設定」を選択
  • 「詳細設定を表示…」を選択します
  • 「プロキシ設定の変更…」を選択します
  • 「SOCKSプロキシ」を選択
  • 「127.0.0.1」と入力
  • ポート「8080」を入力してください
  • 「OK」を選択して変更を保存します

Google で「my ip」を検索し、現在の IP アドレスを確認してください。

これにより、ポート 8080 で SSH トンネルが起動し、すべてのトラフィックが (安全に) example.com のサーバーを経由してルーティングされます。

SSHトンネルの終了

SSH トンネルを終了するには、ブラウザ内で SOCKS プロキシを無効にするだけです。

ソース

2番目の方法:

Shellinaboxを使えば簡単にできます

ユニバースリポジトリをチェックしたことを確認してください

インストールするには

 $ sudo apt-get install openssl shellinabox

Shellinaboxの設定

デフォルトでは、shellinaboxd はローカルホストの TCP ポート 4200 をリッスンします。インストール中に、HTTPS プロトコルを使用するために、新しい自己署名 SSL 証明書が「/var/lib/shellinabox」の下に自動的に作成されます。

$ sudo vi /etc/default/shellinabox

# specify the IP address of a destination SSH server
SHELLINABOX_ARGS="--o-beep -s /:SSH:172.16.25.125"

# if you want to restrict access to shellinaboxd from localhost only
SHELLINABOX_ARGS="--o-beep -s /:SSH:172.16.25.125 --localhost-only"

注意: IP 172.16.25.125 を自分のものに置き換えてください

Shellinabox の起動

設定が完了したら、サービスを開始できます。

$ sudo service shellinaboxd start

Shellinaboxを確認する

ここで、「netstat」コマンドを使用して、Shellinabox がポート 4200 で実行されているかどうかを確認しましょう。

$ sudo netstat -nap | grep shellinabox
or
# netstat -nap | grep shellinabox

tcp        0      0 0.0.0.0:4200            0.0.0.0:*               LISTEN      12274/shellinaboxd

次に、Web ブラウザを開き、「https://"Your-IP-Adress:6175"」に移動します。Web ベースの SSH ターミナルが表示されるはずです。ユーザー名とパスワードを使用してログインすると、シェル プロンプトが表示されます。

ここに画像の説明を入力してください

ソース

答え2

あなたが提供した例は正しいですが、やや誤解を招く可能性があります。これは機能するはずです:

ssh -L 8080:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server

たとえば、ローカルで表示したい次の Web ページにアクセスできる ssh を実行しているリモート ボックスを考えます。

http://192.168.1.2/index.html

ローカル ボックス上にトンネルを作成してリモート ページを参照できるようにするには、ローカルで次のコマンドを実行します。

ssh -L 8080:192.168.1.2:80 user@remote-ssh-server

そして、Web ブラウザで次のサイトにアクセスします。

http://localhost:8080/index.html

ポート指定子を省略する必要がある場合 (または省略したい場合)、80 は「特権」ポート (<1024) であるため、ルートとしてトンネルを開く必要があります。

sudo ssh -L 80:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server

その後、ローカルにアクセスするだけです:

ローカルホスト

その他の設定は必要ありません。

ちなみに、これはシングルローカルで確認したいホスト。さらに確認する必要がある場合は、他のポートでさらにトンネルを開くか、プロキシを介してすべてのリモート ホストの要求をトンネルする他のソリューションを検討する必要があります。

-Lこれは、スイッチの 3 回目の使用例ですman ssh

 -L [bind_address:]port:host:hostport
 -L [bind_address:]port:remote_socket
 -L local_socket:host:hostport
 -L local_socket:remote_socket
         Specifies that connections to the given TCP port or Unix socket on the
         local (client) host are to be forwarded to the given host and port, or
         Unix socket, on the remote side.  This works by allocating a socket to
         listen to either a TCP port on the local side, optionally bound to the
         specified bind_address, or to a Unix socket.  Whenever a connection is
         made to the local port or socket, the connection is forwarded over the
         secure channel, and a connection is made to either host port hostport,
         or the Unix socket remote_socket, from the remote machine.

         Port forwardings can also be specified in the configuration file.  Only
         the superuser can forward privileged ports.  IPv6 addresses can be
         specified by enclosing the address in square brackets.

         By default, the local port is bound in accordance with the GatewayPorts
         setting.  However, an explicit bind_address may be used to bind the
         connection to a specific address.  The bind_address of “localhost”
         indicates that the listening port be bound for local use only, while an
         empty address or ‘*’ indicates that the port should be available from
         all interfaces.

関連情報