access webpage through ssh
I need to access the IEEE xplore, but I don't have right to download out of institute.
I can login into the server of institute via ssh,
so How can I access IEEE xplore through institute server via ssh?
I have searched solutions, some one answer:
ssh -L 8080:localhost:80 user@remoteserver
and then he says:
Now, point your local browser to localhost:8080. It should be forwarded to localhost:80 in the remote server.###
But I still don't know how to configure my laptop,Im using chrome.
I appreciate your help very much!
ssh localhost html
add a comment |
I need to access the IEEE xplore, but I don't have right to download out of institute.
I can login into the server of institute via ssh,
so How can I access IEEE xplore through institute server via ssh?
I have searched solutions, some one answer:
ssh -L 8080:localhost:80 user@remoteserver
and then he says:
Now, point your local browser to localhost:8080. It should be forwarded to localhost:80 in the remote server.###
But I still don't know how to configure my laptop,Im using chrome.
I appreciate your help very much!
ssh localhost html
Good reference here: help.ubuntu.com/community/SSH/OpenSSH/PortForwarding
– ThorSummoner
Sep 25 '15 at 18:32
add a comment |
I need to access the IEEE xplore, but I don't have right to download out of institute.
I can login into the server of institute via ssh,
so How can I access IEEE xplore through institute server via ssh?
I have searched solutions, some one answer:
ssh -L 8080:localhost:80 user@remoteserver
and then he says:
Now, point your local browser to localhost:8080. It should be forwarded to localhost:80 in the remote server.###
But I still don't know how to configure my laptop,Im using chrome.
I appreciate your help very much!
ssh localhost html
I need to access the IEEE xplore, but I don't have right to download out of institute.
I can login into the server of institute via ssh,
so How can I access IEEE xplore through institute server via ssh?
I have searched solutions, some one answer:
ssh -L 8080:localhost:80 user@remoteserver
and then he says:
Now, point your local browser to localhost:8080. It should be forwarded to localhost:80 in the remote server.###
But I still don't know how to configure my laptop,Im using chrome.
I appreciate your help very much!
ssh localhost html
ssh localhost html
edited Jul 9 '15 at 7:33
Maythux
50.8k32169217
50.8k32169217
asked Feb 3 '14 at 17:14
ulyssis2ulyssis2
173226
173226
Good reference here: help.ubuntu.com/community/SSH/OpenSSH/PortForwarding
– ThorSummoner
Sep 25 '15 at 18:32
add a comment |
Good reference here: help.ubuntu.com/community/SSH/OpenSSH/PortForwarding
– ThorSummoner
Sep 25 '15 at 18:32
Good reference here: help.ubuntu.com/community/SSH/OpenSSH/PortForwarding
– ThorSummoner
Sep 25 '15 at 18:32
Good reference here: help.ubuntu.com/community/SSH/OpenSSH/PortForwarding
– ThorSummoner
Sep 25 '15 at 18:32
add a comment |
2 Answers
2
active
oldest
votes
First Method:
Launch an SSH tunnel
To initiate your SSH tunnel, simply open terminal and connect to your remote server via SSH with the following flags:
ssh -D 8080 -C -N username@example.com
Browse the Web with Your SSH Tunnel (Chrome)
Now, let’s start browsing the web using our new SSH tunnel.
- Open Google Chrome
- Select the wrench icon on the top right
- Select ‘Settings’
- Select ‘Show advanced settings…’
- Select ‘Change proxy settings…’
- Select ‘SOCKS Proxy’
- Enter ’127.0.0.1′
- Enter port ’8080′
- Save changes by selecting ‘OK’
Search Google for ‘my ip’ and take a look at what your IP address is now.
This will launch our SSH tunnel on port 8080 and route all traffic (securely) through the server at example.com.
Exiting the SSH Tunnel
To exit the SSH tunnel, simply disable the SOCKS proxy within your browser.
source
Second Method:
You can do it easily using Shellinabox
Ensure that you have checked Universe Repository
To install
$ sudo apt-get install openssl shellinabox
Configuring Shellinabox
By default, shellinaboxd listens on TCP port 4200 on localhost.During installation a new self-signed SSL certificate automatically created under “/var/lib/shellinabox” to use HTTPS protocol.
$ 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"
NB: replace the ip 172.16.25.125 with yours
Starting Shellinabox
Once you’ve done with the configuration, you can start the service
$ sudo service shellinaboxd start
Verify Shellinabox
Now let’s verify whether Shellinabox is running on port 4200 using “netstat” command.
$ 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
Now open up your web browser, and navigate to 'https://"Your-IP-Adress:6175"'. You should be able to see a web-based SSH terminal. Login using your username and password and you should be presented with your shell prompt.
source
@maythus, thank you very much, your answers are great. I solve my problem with the solution 1.
– ulyssis2
Feb 5 '14 at 9:59
@ulyssis2 You are very welcomed buddy
– Maythux
Feb 5 '14 at 10:00
@Maythux, thanks man! learnt something new :)
– kimerseen
Jul 9 '15 at 7:34
@kimerseen You are welcome friend
– Maythux
Jul 9 '15 at 7:35
@Maythux can u help me with my question askubuntu.com/questions/987626/shell-in-a-box-session-closed
– MiHawk
Dec 19 '17 at 6:52
add a comment |
The example you provided is correct, but somewhat misleading. This should work:
ssh -L 8080:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server
For example, consider a remote box running ssh that can access this web-page, which I want to see locally:
http://192.168.1.2/index.html
To create a tunnel on my local box that allows me to browse to that remote page, I run locally:
ssh -L 8080:192.168.1.2:80 user@remote-ssh-server
And, then in a web-browser, I visit:
http://localhost:8080/index.html
If you need (or want) to omit the port specifier, you will need to open the tunnel as root, since 80 is a "privileged" port (<1024):
sudo ssh -L 80:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server
Then, you can just visit locally:
http://localhost/index.html
No other configuration is required.
Incidentally, this only works for a single host that you want to see locally. If you need to see more, you either need to open more tunnels on other ports or examine the other solutions that tunnel requests for all remote hosts through a proxy.
This is the 3rd usage of the -L
switch from 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.
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f414930%2faccess-webpage-through-ssh%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
First Method:
Launch an SSH tunnel
To initiate your SSH tunnel, simply open terminal and connect to your remote server via SSH with the following flags:
ssh -D 8080 -C -N username@example.com
Browse the Web with Your SSH Tunnel (Chrome)
Now, let’s start browsing the web using our new SSH tunnel.
- Open Google Chrome
- Select the wrench icon on the top right
- Select ‘Settings’
- Select ‘Show advanced settings…’
- Select ‘Change proxy settings…’
- Select ‘SOCKS Proxy’
- Enter ’127.0.0.1′
- Enter port ’8080′
- Save changes by selecting ‘OK’
Search Google for ‘my ip’ and take a look at what your IP address is now.
This will launch our SSH tunnel on port 8080 and route all traffic (securely) through the server at example.com.
Exiting the SSH Tunnel
To exit the SSH tunnel, simply disable the SOCKS proxy within your browser.
source
Second Method:
You can do it easily using Shellinabox
Ensure that you have checked Universe Repository
To install
$ sudo apt-get install openssl shellinabox
Configuring Shellinabox
By default, shellinaboxd listens on TCP port 4200 on localhost.During installation a new self-signed SSL certificate automatically created under “/var/lib/shellinabox” to use HTTPS protocol.
$ 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"
NB: replace the ip 172.16.25.125 with yours
Starting Shellinabox
Once you’ve done with the configuration, you can start the service
$ sudo service shellinaboxd start
Verify Shellinabox
Now let’s verify whether Shellinabox is running on port 4200 using “netstat” command.
$ 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
Now open up your web browser, and navigate to 'https://"Your-IP-Adress:6175"'. You should be able to see a web-based SSH terminal. Login using your username and password and you should be presented with your shell prompt.
source
@maythus, thank you very much, your answers are great. I solve my problem with the solution 1.
– ulyssis2
Feb 5 '14 at 9:59
@ulyssis2 You are very welcomed buddy
– Maythux
Feb 5 '14 at 10:00
@Maythux, thanks man! learnt something new :)
– kimerseen
Jul 9 '15 at 7:34
@kimerseen You are welcome friend
– Maythux
Jul 9 '15 at 7:35
@Maythux can u help me with my question askubuntu.com/questions/987626/shell-in-a-box-session-closed
– MiHawk
Dec 19 '17 at 6:52
add a comment |
First Method:
Launch an SSH tunnel
To initiate your SSH tunnel, simply open terminal and connect to your remote server via SSH with the following flags:
ssh -D 8080 -C -N username@example.com
Browse the Web with Your SSH Tunnel (Chrome)
Now, let’s start browsing the web using our new SSH tunnel.
- Open Google Chrome
- Select the wrench icon on the top right
- Select ‘Settings’
- Select ‘Show advanced settings…’
- Select ‘Change proxy settings…’
- Select ‘SOCKS Proxy’
- Enter ’127.0.0.1′
- Enter port ’8080′
- Save changes by selecting ‘OK’
Search Google for ‘my ip’ and take a look at what your IP address is now.
This will launch our SSH tunnel on port 8080 and route all traffic (securely) through the server at example.com.
Exiting the SSH Tunnel
To exit the SSH tunnel, simply disable the SOCKS proxy within your browser.
source
Second Method:
You can do it easily using Shellinabox
Ensure that you have checked Universe Repository
To install
$ sudo apt-get install openssl shellinabox
Configuring Shellinabox
By default, shellinaboxd listens on TCP port 4200 on localhost.During installation a new self-signed SSL certificate automatically created under “/var/lib/shellinabox” to use HTTPS protocol.
$ 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"
NB: replace the ip 172.16.25.125 with yours
Starting Shellinabox
Once you’ve done with the configuration, you can start the service
$ sudo service shellinaboxd start
Verify Shellinabox
Now let’s verify whether Shellinabox is running on port 4200 using “netstat” command.
$ 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
Now open up your web browser, and navigate to 'https://"Your-IP-Adress:6175"'. You should be able to see a web-based SSH terminal. Login using your username and password and you should be presented with your shell prompt.
source
@maythus, thank you very much, your answers are great. I solve my problem with the solution 1.
– ulyssis2
Feb 5 '14 at 9:59
@ulyssis2 You are very welcomed buddy
– Maythux
Feb 5 '14 at 10:00
@Maythux, thanks man! learnt something new :)
– kimerseen
Jul 9 '15 at 7:34
@kimerseen You are welcome friend
– Maythux
Jul 9 '15 at 7:35
@Maythux can u help me with my question askubuntu.com/questions/987626/shell-in-a-box-session-closed
– MiHawk
Dec 19 '17 at 6:52
add a comment |
First Method:
Launch an SSH tunnel
To initiate your SSH tunnel, simply open terminal and connect to your remote server via SSH with the following flags:
ssh -D 8080 -C -N username@example.com
Browse the Web with Your SSH Tunnel (Chrome)
Now, let’s start browsing the web using our new SSH tunnel.
- Open Google Chrome
- Select the wrench icon on the top right
- Select ‘Settings’
- Select ‘Show advanced settings…’
- Select ‘Change proxy settings…’
- Select ‘SOCKS Proxy’
- Enter ’127.0.0.1′
- Enter port ’8080′
- Save changes by selecting ‘OK’
Search Google for ‘my ip’ and take a look at what your IP address is now.
This will launch our SSH tunnel on port 8080 and route all traffic (securely) through the server at example.com.
Exiting the SSH Tunnel
To exit the SSH tunnel, simply disable the SOCKS proxy within your browser.
source
Second Method:
You can do it easily using Shellinabox
Ensure that you have checked Universe Repository
To install
$ sudo apt-get install openssl shellinabox
Configuring Shellinabox
By default, shellinaboxd listens on TCP port 4200 on localhost.During installation a new self-signed SSL certificate automatically created under “/var/lib/shellinabox” to use HTTPS protocol.
$ 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"
NB: replace the ip 172.16.25.125 with yours
Starting Shellinabox
Once you’ve done with the configuration, you can start the service
$ sudo service shellinaboxd start
Verify Shellinabox
Now let’s verify whether Shellinabox is running on port 4200 using “netstat” command.
$ 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
Now open up your web browser, and navigate to 'https://"Your-IP-Adress:6175"'. You should be able to see a web-based SSH terminal. Login using your username and password and you should be presented with your shell prompt.
source
First Method:
Launch an SSH tunnel
To initiate your SSH tunnel, simply open terminal and connect to your remote server via SSH with the following flags:
ssh -D 8080 -C -N username@example.com
Browse the Web with Your SSH Tunnel (Chrome)
Now, let’s start browsing the web using our new SSH tunnel.
- Open Google Chrome
- Select the wrench icon on the top right
- Select ‘Settings’
- Select ‘Show advanced settings…’
- Select ‘Change proxy settings…’
- Select ‘SOCKS Proxy’
- Enter ’127.0.0.1′
- Enter port ’8080′
- Save changes by selecting ‘OK’
Search Google for ‘my ip’ and take a look at what your IP address is now.
This will launch our SSH tunnel on port 8080 and route all traffic (securely) through the server at example.com.
Exiting the SSH Tunnel
To exit the SSH tunnel, simply disable the SOCKS proxy within your browser.
source
Second Method:
You can do it easily using Shellinabox
Ensure that you have checked Universe Repository
To install
$ sudo apt-get install openssl shellinabox
Configuring Shellinabox
By default, shellinaboxd listens on TCP port 4200 on localhost.During installation a new self-signed SSL certificate automatically created under “/var/lib/shellinabox” to use HTTPS protocol.
$ 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"
NB: replace the ip 172.16.25.125 with yours
Starting Shellinabox
Once you’ve done with the configuration, you can start the service
$ sudo service shellinaboxd start
Verify Shellinabox
Now let’s verify whether Shellinabox is running on port 4200 using “netstat” command.
$ 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
Now open up your web browser, and navigate to 'https://"Your-IP-Adress:6175"'. You should be able to see a web-based SSH terminal. Login using your username and password and you should be presented with your shell prompt.
source
edited Feb 3 '14 at 17:51
answered Feb 3 '14 at 17:42
MaythuxMaythux
50.8k32169217
50.8k32169217
@maythus, thank you very much, your answers are great. I solve my problem with the solution 1.
– ulyssis2
Feb 5 '14 at 9:59
@ulyssis2 You are very welcomed buddy
– Maythux
Feb 5 '14 at 10:00
@Maythux, thanks man! learnt something new :)
– kimerseen
Jul 9 '15 at 7:34
@kimerseen You are welcome friend
– Maythux
Jul 9 '15 at 7:35
@Maythux can u help me with my question askubuntu.com/questions/987626/shell-in-a-box-session-closed
– MiHawk
Dec 19 '17 at 6:52
add a comment |
@maythus, thank you very much, your answers are great. I solve my problem with the solution 1.
– ulyssis2
Feb 5 '14 at 9:59
@ulyssis2 You are very welcomed buddy
– Maythux
Feb 5 '14 at 10:00
@Maythux, thanks man! learnt something new :)
– kimerseen
Jul 9 '15 at 7:34
@kimerseen You are welcome friend
– Maythux
Jul 9 '15 at 7:35
@Maythux can u help me with my question askubuntu.com/questions/987626/shell-in-a-box-session-closed
– MiHawk
Dec 19 '17 at 6:52
@maythus, thank you very much, your answers are great. I solve my problem with the solution 1.
– ulyssis2
Feb 5 '14 at 9:59
@maythus, thank you very much, your answers are great. I solve my problem with the solution 1.
– ulyssis2
Feb 5 '14 at 9:59
@ulyssis2 You are very welcomed buddy
– Maythux
Feb 5 '14 at 10:00
@ulyssis2 You are very welcomed buddy
– Maythux
Feb 5 '14 at 10:00
@Maythux, thanks man! learnt something new :)
– kimerseen
Jul 9 '15 at 7:34
@Maythux, thanks man! learnt something new :)
– kimerseen
Jul 9 '15 at 7:34
@kimerseen You are welcome friend
– Maythux
Jul 9 '15 at 7:35
@kimerseen You are welcome friend
– Maythux
Jul 9 '15 at 7:35
@Maythux can u help me with my question askubuntu.com/questions/987626/shell-in-a-box-session-closed
– MiHawk
Dec 19 '17 at 6:52
@Maythux can u help me with my question askubuntu.com/questions/987626/shell-in-a-box-session-closed
– MiHawk
Dec 19 '17 at 6:52
add a comment |
The example you provided is correct, but somewhat misleading. This should work:
ssh -L 8080:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server
For example, consider a remote box running ssh that can access this web-page, which I want to see locally:
http://192.168.1.2/index.html
To create a tunnel on my local box that allows me to browse to that remote page, I run locally:
ssh -L 8080:192.168.1.2:80 user@remote-ssh-server
And, then in a web-browser, I visit:
http://localhost:8080/index.html
If you need (or want) to omit the port specifier, you will need to open the tunnel as root, since 80 is a "privileged" port (<1024):
sudo ssh -L 80:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server
Then, you can just visit locally:
http://localhost/index.html
No other configuration is required.
Incidentally, this only works for a single host that you want to see locally. If you need to see more, you either need to open more tunnels on other ports or examine the other solutions that tunnel requests for all remote hosts through a proxy.
This is the 3rd usage of the -L
switch from 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.
New contributor
add a comment |
The example you provided is correct, but somewhat misleading. This should work:
ssh -L 8080:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server
For example, consider a remote box running ssh that can access this web-page, which I want to see locally:
http://192.168.1.2/index.html
To create a tunnel on my local box that allows me to browse to that remote page, I run locally:
ssh -L 8080:192.168.1.2:80 user@remote-ssh-server
And, then in a web-browser, I visit:
http://localhost:8080/index.html
If you need (or want) to omit the port specifier, you will need to open the tunnel as root, since 80 is a "privileged" port (<1024):
sudo ssh -L 80:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server
Then, you can just visit locally:
http://localhost/index.html
No other configuration is required.
Incidentally, this only works for a single host that you want to see locally. If you need to see more, you either need to open more tunnels on other ports or examine the other solutions that tunnel requests for all remote hosts through a proxy.
This is the 3rd usage of the -L
switch from 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.
New contributor
add a comment |
The example you provided is correct, but somewhat misleading. This should work:
ssh -L 8080:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server
For example, consider a remote box running ssh that can access this web-page, which I want to see locally:
http://192.168.1.2/index.html
To create a tunnel on my local box that allows me to browse to that remote page, I run locally:
ssh -L 8080:192.168.1.2:80 user@remote-ssh-server
And, then in a web-browser, I visit:
http://localhost:8080/index.html
If you need (or want) to omit the port specifier, you will need to open the tunnel as root, since 80 is a "privileged" port (<1024):
sudo ssh -L 80:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server
Then, you can just visit locally:
http://localhost/index.html
No other configuration is required.
Incidentally, this only works for a single host that you want to see locally. If you need to see more, you either need to open more tunnels on other ports or examine the other solutions that tunnel requests for all remote hosts through a proxy.
This is the 3rd usage of the -L
switch from 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.
New contributor
The example you provided is correct, but somewhat misleading. This should work:
ssh -L 8080:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server
For example, consider a remote box running ssh that can access this web-page, which I want to see locally:
http://192.168.1.2/index.html
To create a tunnel on my local box that allows me to browse to that remote page, I run locally:
ssh -L 8080:192.168.1.2:80 user@remote-ssh-server
And, then in a web-browser, I visit:
http://localhost:8080/index.html
If you need (or want) to omit the port specifier, you will need to open the tunnel as root, since 80 is a "privileged" port (<1024):
sudo ssh -L 80:<remote-web-host-you-want-to-see>:80 remote-user@remote-ssh-server
Then, you can just visit locally:
http://localhost/index.html
No other configuration is required.
Incidentally, this only works for a single host that you want to see locally. If you need to see more, you either need to open more tunnels on other ports or examine the other solutions that tunnel requests for all remote hosts through a proxy.
This is the 3rd usage of the -L
switch from 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.
New contributor
edited 4 mins ago
New contributor
answered 12 mins ago
TrevorTrevor
1012
1012
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f414930%2faccess-webpage-through-ssh%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Good reference here: help.ubuntu.com/community/SSH/OpenSSH/PortForwarding
– ThorSummoner
Sep 25 '15 at 18:32