SSH를 통해 웹페이지에 접속

SSH를 통해 웹페이지에 접속

IEEE xplore에 접속해야 하는데 기관 외부에서 다운로드할 수 있는 권한이 없습니다.

SSH를 통해 학원 서버에 로그인할 수 있고,

그렇다면 SSH를 통해 연구소 서버를 통해 IEEE xplore에 어떻게 액세스할 수 있나요?

솔루션을 검색했는데 일부 답변은 다음과 같습니다.

ssh -L 8080:localhost:80 user@remoteserver

그리고 그는 이렇게 말합니다.

이제 로컬 브라우저에서 localhost:8080을 지정하십시오. 원격 서버의 localhost:80으로 전달되어야 합니다.### 하지만 아직 노트북을 구성하는 방법을 모르겠습니다. 저는 크롬을 사용하고 있습니다.

귀하의 도움에 진심으로 감사드립니다!

답변1

첫 번째 방법:

SSH 터널 실행

SSH 터널을 시작하려면 터미널을 열고 다음 플래그를 사용하여 SSH를 통해 원격 서버에 연결하기만 하면 됩니다.

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

SSH 터널로 웹 탐색(Chrome)

이제 새로운 SSH 터널을 사용하여 웹 검색을 시작해 보겠습니다.

  • Google 크롬을 엽니다.
  • 오른쪽 상단에 있는 렌치 아이콘을 선택하세요.
  • '설정'을 선택하세요.
  • '고급 설정 표시...'를 선택하세요.
  • '프록시 설정 변경...'을 선택하세요.
  • 'SOCKS 프록시'를 선택하세요.
  • '127.0.0.1'을 입력하세요.
  • 포트 '8080'을 입력하세요
  • '확인'을 선택하여 변경 사항을 저장하세요.

Google에서 'my ip'를 검색하여 현재 귀하의 IP 주소가 무엇인지 살펴보세요.

그러면 포트 8080에서 SSH 터널이 시작되고 example.com의 서버를 통해 모든 트래픽이 (안전하게) 라우팅됩니다.

SSH 터널 종료

SSH 터널을 종료하려면 브라우저 내에서 SOCKS 프록시를 비활성화하면 됩니다.

원천

두 번째 방법:

Shellinabox를 사용하면 쉽게 할 수 있습니다

Universe Repository를 확인했는지 확인하세요.

설치하기 위해서

 $ sudo apt-get install openssl shellinabox

Shellinabox 구성

기본적으로 shellinaboxd는 localhost의 TCP 포트 4200을 수신합니다. 설치 중에 HTTPS 프로토콜을 사용하기 위해 "/var/lib/shellinabox" 아래에 새로운 자체 서명 SSL 인증서가 자동으로 생성됩니다.

$ 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를 귀하의 IP로 교체하세요.

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

이제 웹 브라우저를 열고 'https://"Your-IP-Adress:6175"'로 이동하세요. 웹 기반 SSH 터미널을 볼 수 있어야 합니다. 사용자 이름과 비밀번호를 사용하여 로그인하면 쉘 프롬프트가 표시됩니다.

여기에 이미지 설명을 입력하세요

원천

답변2

제공하신 예는 정확하지만 다소 오해의 소지가 있습니다. 이것은 작동합니다:

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

예를 들어, 로컬에서 보고 싶은 이 웹 페이지에 액세스할 수 있는 SSH를 실행하는 원격 상자를 생각해 보세요.

http://192.168.1.2/index.html

원격 페이지를 탐색할 수 있는 터널을 로컬 상자에 생성하려면 로컬에서 다음을 실행합니다.

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

그런 다음 웹 브라우저에서 다음을 방문합니다.

http://localhost:8080/index.html

포트 지정자를 생략해야 하는 경우(또는 원하는 경우) 80이 "권한 있는" 포트(<1024)이므로 루트로 터널을 열어야 합니다.

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

그런 다음 로컬로 방문하면 됩니다.

http://localhost/index.html

다른 구성은 필요하지 않습니다.

참고로 이는 다음 경우에만 작동합니다.하나의로컬에서 보고 싶은 호스트. 더 많은 것을 보려면 다른 포트에서 더 많은 터널을 열거나 프록시를 통해 모든 원격 호스트에 대한 요청을 터널링하는 다른 솔루션을 검사해야 합니다.

이것은 -L다음에서 스위치 를 세 번째로 사용하는 것입니다 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.

관련 정보