Skip to main content

This is my experience of using ssh for connecting a computer without static ip address from a remote computer.This is required to manage projects in server (serving in LAN) with no static ip to use

Requirement for setup and demo:

  • Linux in with an ssh server with static IP ( call it boss.com )
  • Linux in with an ssh/web server with no static IP. (call it target)
  • Linux / Android phone with JuiceSSH

ensure folwoingEnsure the following is in /etc/ssh/sshd_config
/etc/ssh/sshd_config:
GatewayPorts yes

runRun following in target computer to use boss.com:1008 as web address for target

ssh -R 1008:127.0.0.1:80 [email protected]

Now you can excess target web server as boot.com:1008 from any device (try with browser from your mobile device)

runRun following in target computer to connect target computer via ssh(at 2048 port)

ssh -R 1008:127.0.0.1:2048 [email protected]

Now you can excess target computer with following command

ssh [email protected]:1008

Or use JuiceSSH from android phone to test

Accessing server with root password is not good idea.

Create user mytunnel in boss.com
replace root with mytunnel in above examples

Lastly do following to ensure that mytunnel user can do only tunneling work via boss.com

  • in /etc/passwd in boss.com, replace shell of mytunnel from /bin/bash to /bin/false

  • add -f -N in above commands
    ssh -f -N -R 1008:127.0.0.1:80 [email protected]
    ssh -f -N -R 1008:127.0.0.1:2048 [email protected]

  • Now, user mytunnel can use only ssh-tunnel functionality from server

This is my experience of using ssh for connecting a computer without static ip address from a remote computer.This is required to manage projects in server (serving in LAN) with no static ip to use

Requirement for setup and demo:

  • Linux in with an ssh server with static IP ( call it boss.com )
  • Linux in with an ssh/web server with no static IP. (call it target)
  • Linux / Android phone with JuiceSSH

ensure folwoing in /etc/ssh/sshd_config
GatewayPorts yes

run following in target computer to use boss.com:1008 as web address for target

ssh -R 1008:127.0.0.1:80 [email protected]

Now you can excess target web server as boot.com:1008 from any device (try with browser from your mobile device)

run following in target computer to connect target computer via ssh(at 2048 port)

ssh -R 1008:127.0.0.1:2048 [email protected]

Now you can excess target computer with following command

ssh [email protected]:1008

Or use JuiceSSH from android phone to test

Accessing server with root password is not good idea.

Create user mytunnel in boss.com
replace root with mytunnel in above examples

Lastly do following to ensure that mytunnel user can do only tunneling work via boss.com

  • in /etc/passwd in boss.com, replace shell of mytunnel from /bin/bash to /bin/false

  • add -f -N in above commands
    ssh -f -N -R 1008:127.0.0.1:80 [email protected]
    ssh -f -N -R 1008:127.0.0.1:2048 [email protected]

  • Now, user mytunnel can use only ssh-tunnel functionality from server

This is my experience of using ssh for connecting a computer without static ip address from a remote computer.This is required to manage projects in server (serving in LAN) with no static ip to use

Requirement for setup and demo:

  • Linux in with an ssh server with static IP ( call it boss.com )
  • Linux in with an ssh/web server with no static IP. (call it target)
  • Linux / Android phone with JuiceSSH

Ensure the following is in /etc/ssh/sshd_config:
GatewayPorts yes

Run following in target computer to use boss.com:1008 as web address for target

ssh -R 1008:127.0.0.1:80 [email protected]

Now you can excess target web server as boot.com:1008 from any device (try with browser from your mobile device)

Run following in target computer to connect target computer via ssh(at 2048 port)

ssh -R 1008:127.0.0.1:2048 [email protected]

Now you can excess target computer with following command

ssh [email protected]:1008

Or use JuiceSSH from android phone to test

Accessing server with root password is not good idea.

Create user mytunnel in boss.com
replace root with mytunnel in above examples

Lastly do following to ensure that mytunnel user can do only tunneling work via boss.com

  • in /etc/passwd in boss.com, replace shell of mytunnel from /bin/bash to /bin/false

  • add -f -N in above commands
    ssh -f -N -R 1008:127.0.0.1:80 [email protected]
    ssh -f -N -R 1008:127.0.0.1:2048 [email protected]

  • Now, user mytunnel can use only ssh-tunnel functionality from server

added 64 characters in body
Source Link

This is my experience of using ssh for connecting a computer without static ip address from a remote computer.This is required to manage projects in server (serving in LAN) with no static ip to use

Requirement for setup and demo:

  • Linux in with an ssh server with static IP ( call it boss.com )
  • Linux in with an ssh/web server with no static IP. (call it target)
  • Linux / Android phone with JuiceSSH

ensure folwoing in /etc/ssh/sshd_config
GatewayPorts yes

run following in target computer to use boss.com:1008 as web address for target

ssh -R 1008:127.0.0.1:80 [email protected]

Now you can excess target web server as boot.com:1008 from any device (try with browser from your mobile device)

run following in target computer to connect target computer via ssh(at 2048 port)

ssh -R 1008:127.0.0.1:2048 [email protected]

Now you can excess target computer with following command

ssh [email protected]:1008

Or use JuiceSSH from android phone to test

Accessing server with root password is not good idea.

Create user mytunnel in boss.com
replace root with mytunnel in above examples

Lastly do following to ensure that mytunnel user can do only tunneling work via boss.com

  • in /etc/passwd in boss.com, replace shell of mytunnel from /bin/bash to /bin/false

  • add -f -N in above commands
    ssh -f -N -R 1008:127.0.0.1:80 [email protected]
    ssh -f -N -R 1008:127.0.0.1:2048 [email protected]

  • Now, user mytunnel can use only ssh-tunnel functionality from server

This is my experience of using ssh for connecting a computer without static ip address from a remote computer.This is required to manage projects in server (serving in LAN) with no static ip to use

Requirement for setup and demo:

  • Linux in with an ssh server with static IP ( call it boss.com )
  • Linux in with an ssh/web server with no static IP. (call it target)
  • Linux / Android phone with JuiceSSH

run following in target computer to use boss.com:1008 as web address for target

ssh -R 1008:127.0.0.1:80 [email protected]

Now you can excess target web server as boot.com:1008 from any device (try with browser from your mobile device)

run following in target computer to connect target computer via ssh(at 2048 port)

ssh -R 1008:127.0.0.1:2048 [email protected]

Now you can excess target computer with following command

ssh [email protected]:1008

Or use JuiceSSH from android phone to test

Accessing server with root password is not good idea.

Create user mytunnel in boss.com
replace root with mytunnel in above examples

Lastly do following to ensure that mytunnel user can do only tunneling work via boss.com

  • in /etc/passwd in boss.com, replace shell of mytunnel from /bin/bash to /bin/false

  • add -f -N in above commands
    ssh -f -N -R 1008:127.0.0.1:80 [email protected]
    ssh -f -N -R 1008:127.0.0.1:2048 [email protected]

  • Now, user mytunnel can use only ssh-tunnel functionality from server

This is my experience of using ssh for connecting a computer without static ip address from a remote computer.This is required to manage projects in server (serving in LAN) with no static ip to use

Requirement for setup and demo:

  • Linux in with an ssh server with static IP ( call it boss.com )
  • Linux in with an ssh/web server with no static IP. (call it target)
  • Linux / Android phone with JuiceSSH

ensure folwoing in /etc/ssh/sshd_config
GatewayPorts yes

run following in target computer to use boss.com:1008 as web address for target

ssh -R 1008:127.0.0.1:80 [email protected]

Now you can excess target web server as boot.com:1008 from any device (try with browser from your mobile device)

run following in target computer to connect target computer via ssh(at 2048 port)

ssh -R 1008:127.0.0.1:2048 [email protected]

Now you can excess target computer with following command

ssh [email protected]:1008

Or use JuiceSSH from android phone to test

Accessing server with root password is not good idea.

Create user mytunnel in boss.com
replace root with mytunnel in above examples

Lastly do following to ensure that mytunnel user can do only tunneling work via boss.com

  • in /etc/passwd in boss.com, replace shell of mytunnel from /bin/bash to /bin/false

  • add -f -N in above commands
    ssh -f -N -R 1008:127.0.0.1:80 [email protected]
    ssh -f -N -R 1008:127.0.0.1:2048 [email protected]

  • Now, user mytunnel can use only ssh-tunnel functionality from server

Source Link

This is my experience of using ssh for connecting a computer without static ip address from a remote computer.This is required to manage projects in server (serving in LAN) with no static ip to use

Requirement for setup and demo:

  • Linux in with an ssh server with static IP ( call it boss.com )
  • Linux in with an ssh/web server with no static IP. (call it target)
  • Linux / Android phone with JuiceSSH

run following in target computer to use boss.com:1008 as web address for target

ssh -R 1008:127.0.0.1:80 [email protected]

Now you can excess target web server as boot.com:1008 from any device (try with browser from your mobile device)

run following in target computer to connect target computer via ssh(at 2048 port)

ssh -R 1008:127.0.0.1:2048 [email protected]

Now you can excess target computer with following command

ssh [email protected]:1008

Or use JuiceSSH from android phone to test

Accessing server with root password is not good idea.

Create user mytunnel in boss.com
replace root with mytunnel in above examples

Lastly do following to ensure that mytunnel user can do only tunneling work via boss.com

  • in /etc/passwd in boss.com, replace shell of mytunnel from /bin/bash to /bin/false

  • add -f -N in above commands
    ssh -f -N -R 1008:127.0.0.1:80 [email protected]
    ssh -f -N -R 1008:127.0.0.1:2048 [email protected]

  • Now, user mytunnel can use only ssh-tunnel functionality from server