LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-13-2009, 06:09 AM   #1
Fredrix
LQ Newbie
 
Registered: Jan 2009
Location: Norway
Distribution: suse10, ubuntu
Posts: 13

Rep: Reputation: 0
how do i forward my 22 ssh port?


hello, i'm using putty to remote my server back home from where i work



port 22 (and 21 + other ports) have been disabled and i know the port which are open to use
lets say its 12345 (5digits long)

how do i forward\enable 12345port to work as 22 back to my server?
i'm using suse 11




did not find any good solutions in search, so i'm asking.
Thanks- fredrik






one more Q if this is a question at all....
is there any possible way to turn ON my server whitout touching it?
over the internet etc? wakeonlan?
i got no clues, only clue i got is that this wont work. am i right?

if stupid question, pretend that this question does not exist
 
Old 08-13-2009, 06:20 AM   #2
iambryan
LQ Newbie
 
Registered: Aug 2009
Location: Calgary, AB
Posts: 2

Rep: Reputation: 0
Hey Fredrix. Are you not running a NAT firewall on your internets? Obviously the easiest way to accomplish this would be to just forward port outside:12345 to inside:23. If you are directly connected to the nets then just change or add a new port in /etc/ssh/sshd_config?
 
Old 08-13-2009, 06:29 AM   #3
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by Fredrix View Post
hello, i'm using putty to remote my server back home from where i work



port 22 (and 21 + other ports) have been disabled and i know the port which are open to use
lets say its 12345 (5digits long)

how do i forward\enable 12345port to work as 22 back to my server?
i'm using suse 11




did not find any good solutions in search, so i'm asking.
Thanks- fredrik






one more Q if this is a question at all....
is there any possible way to turn ON my server whitout touching it?
over the internet etc? wakeonlan?
i got no clues, only clue i got is that this wont work. am i right?

if stupid question, pretend that this question does not exist

this is how i do it

on server at work

Code:
#!/bin/sh

# $COMMAND is the command used to create the reverse ssh tunnel
COMMAND='ssh -N -R 12048:localhost:22 homemachine'

# Is the tunnel up?
CHECK_TUNNEL=`ps -eo args | grep "$COMMAND" | grep -v grep`

# If the tunnel is not up, create the tunnel
if [ -z "$CHECK_TUNNEL" ] ; then
   $COMMAND
fi


at home

Code:
ssh -p 12048 localhost
[/code]




ssh -N -R 12048:localhost:22 homemachine --> this command on your server. Pick your ports as you wish.

-N do not execute remote command, just forward the port
-R Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side.

the rest of the script loops always checking the tunnel is up
 
Old 08-16-2009, 11:04 AM   #4
Fredrix
LQ Newbie
 
Registered: Jan 2009
Location: Norway
Distribution: suse10, ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by iambryan View Post
Hey Fredrix. Are you not running a NAT firewall on your internets? Obviously the easiest way to accomplish this would be to just forward port outside:12345 to inside:23. If you are directly connected to the nets then just change or add a new port in /etc/ssh/sshd_config?
how do i forward port outside:12345 to inside:23?
im in sshd_config


im new to this:P
 
Old 08-16-2009, 11:15 AM   #5
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Do you use a router or a modem?
if you use a router, forward port 12345 to port 22 in the router.
If you use a modem, change the port in /etc/ssh/sshd_config
If you hav a firewall, make sure to open the port on the firewall.
 
Old 08-17-2009, 01:57 AM   #6
Fredrix
LQ Newbie
 
Registered: Jan 2009
Location: Norway
Distribution: suse10, ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by repo View Post
Do you use a router or a modem?
if you use a router, forward port 12345 to port 22 in the router.
If you use a modem, change the port in /etc/ssh/sshd_config
If you hav a firewall, make sure to open the port on the firewall.
i use a router, firewall OK
broadband connection both at work and home
but at work the port is blocked, 12345 is open, and i have to use that opened port as ssh\ftp everything-port from work to home when im sitting here trying to connect to my server:22 \21


it sounds easy, but i dont know where\how to forward prot :\
 
Old 08-17-2009, 04:42 AM   #7
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
it sounds easy, but i dont know where\how to forward prot :\
On the router, forward port 12345 to port 22 on the server.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forward Port to SSH Tunnel Gerrit Jan Linux - Networking 1 03-18-2009 05:53 AM
SSH port forward help lucktsm Linux - Software 1 07-08-2008 09:38 PM
SSH port forward problem idsdown Linux - Networking 2 11-25-2005 12:47 AM
ssh port forward failure harmster Linux - Networking 2 03-08-2004 06:46 AM
port forward over ssh bedwardj Linux - Security 1 06-26-2001 04:07 PM


All times are GMT -5. The time now is 05:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration