LinuxQuestions.org
Visit Jeremy's Blog.
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 02-21-2013, 02:11 PM   #1
aviceda
Member
 
Registered: Jul 2003
Location: Brisbane, Queensland, Australia
Posts: 49

Rep: Reputation: 15
ssh and port number


Have struggled with this one for weeks, ssh installed on my mint box and my web-hosting tells me to use a different port number than 22. Edited sshd.config with new port number and then tried to transfer pub key to web-server using ssh name@server.org but keeps telling me that it can't connect to port 22. Should I restart ssh service and if so how?
Unfortunately am typing this at work so can't test out any advice for another eight hours but any assistance would still be gratefully received
Tom
 
Old 02-21-2013, 02:36 PM   #2
pintooo15
Member
 
Registered: May 2004
Location: on the interwebz
Distribution: linux mint 13/sled 11 sp2
Posts: 72

Rep: Reputation: 21
Shouldn't you specify the new port number when connecting to the sshd on serverDOTorg? I believe you need to append " -p <portnum>" after the address to that ssh command.
 
Old 02-21-2013, 02:44 PM   #3
aviceda
Member
 
Registered: Jul 2003
Location: Brisbane, Queensland, Australia
Posts: 49

Original Poster
Rep: Reputation: 15
Thanks Pintooo15, did try adding a colon and a port number after name@server.org:53 but that didn't work, so would you use name@server.org -p 53?
 
Old 02-21-2013, 02:48 PM   #4
pintooo15
Member
 
Registered: May 2004
Location: on the interwebz
Distribution: linux mint 13/sled 11 sp2
Posts: 72

Rep: Reputation: 21
yes the second one with -p is right. but do know that 53 is used for DNS service. for non-standard port numbers choose a port number above 1024.
 
Old 02-21-2013, 02:53 PM   #5
aviceda
Member
 
Registered: Jul 2003
Location: Brisbane, Queensland, Australia
Posts: 49

Original Poster
Rep: Reputation: 15
sorry I only used 53 as an example, it's not the port that my hosting want me to use.
 
Old 02-21-2013, 02:55 PM   #6
pintooo15
Member
 
Registered: May 2004
Location: on the interwebz
Distribution: linux mint 13/sled 11 sp2
Posts: 72

Rep: Reputation: 21
np. issue resolved?
 
Old 02-21-2013, 03:19 PM   #7
aviceda
Member
 
Registered: Jul 2003
Location: Brisbane, Queensland, Australia
Posts: 49

Original Poster
Rep: Reputation: 15
Not yet, will try out your recommendations later this 'arvo (oz time!)
Stay tuned!
 
Old 02-21-2013, 04:15 PM   #8
suicidaleggroll
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 3,199

Rep: Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136Reputation: 1136
ssh is the program you use to connect to a remote machine
sshd is the daemon running on your computer that allows remote machines to connect to you

So by editing sshd_config, all you did is tell your computer to listen for incoming connections on some new port. It doesn't change how you connect to other machines.

You just need to specify the port when you call ssh, such as
Code:
ssh -p 45678 user@server.org
And if you want to scp files to the computer
Code:
scp -P 45678 files user@server.org:/path/to/destination/

Last edited by suicidaleggroll; 02-21-2013 at 04:16 PM.
 
Old 02-21-2013, 04:57 PM   #9
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,581

Rep: Reputation: 480Reputation: 480Reputation: 480Reputation: 480Reputation: 480
yes follow the instructions provided by suicidaleggroll, or you can edit the config in your ~/.ssh/ directory:

Code:
ssma-imac:.ssh ssma$ cat config 
Host	mine.not.yours    #<put your URL here>#
	Port		22222  #<put the correct port here>#

Host	11.11.11.11        #<put the IP of your URL here>#
	Port		22222

Host	*
	Protocol	2
	ForwardAgent	yes
	ForwardX11	yes
	ServeraliveInterval	30
	ServerAliveCountMax	5
	TCPKeepAlive	yes
this way when you ssh or scp it will automatically use these settings. the permissions on that file should be
Code:
rw-r--r--   1 user  group         175 Jan  5 21:28 config
 
  


Reply

Tags
ssh forwarding


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
Port number used by server when using dynamic port forwarding in SSH? kreeder Linux - Networking 4 11-21-2011 03:07 PM
Does anyone know how to specify a ssh port number with fanout? abefroman Linux - Software 12 12-20-2009 08:46 AM
Howto do Secured ssh from port https or port80(standard) to ssh d listening port 22 ? Xeratul Linux - General 4 11-23-2006 07:09 AM
Change ssh port number israel Linux - Software 2 08-30-2006 06:18 AM
Able to change port number between telnet and ssh? x5452 Linux - General 3 03-28-2004 06:04 PM


All times are GMT -5. The time now is 12:43 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration