LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-27-2016, 06:29 AM   #1
sailschooner
LQ Newbie
 
Registered: Jun 2015
Posts: 28

Rep: Reputation: Disabled
can't ssh via required port


Hi,

Sorry to be troubling you with a simple question. I'm using SuSe 13.2. I've just reconnected two machines to my network after a re-install. They will connect to the rest of the network via ssh but only if I specify the port I want them to use in the terminal ssh command, otherwise I get 'connect to host ******* port 22:connection refused'. I'm sure I set the config and sshd_config files to 'port ****'. These are being overridden by something I guess, but what is it, where is it, and what do I do about it? The other machines in the network connect normally and I'm pretty well certain that the machines and the reinstall are OK.

Adrian
 
Old 10-27-2016, 06:31 AM   #2
basica
Member
 
Registered: Nov 2011
Location: Australia
Distribution: Arch, LFS
Posts: 171

Rep: Reputation: 38
Have you restarted the SSH service after changing the port in the config file?
 
Old 10-27-2016, 09:10 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,314
Blog Entries: 3

Rep: Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723
On the client, you would specify the default for any given host (or pattern of hosts) using the ssh_config file. Normally, it is found in ~/.ssh/config. Check what you have there. See the manual page for ssh_config for all your options.

Also, which version of OpenSSH (?) are you running from your client?
 
Old 10-28-2016, 04:23 PM   #4
sailschooner
LQ Newbie
 
Registered: Jun 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
Turbocapitalist, I think you must be thinking of something else. There is a config file in /home/username/.ssh but it's not at all like the ssh_config file which is in /etc/ssh. This is the problem, mine are exactly as the Suse manuals etc. say they should be.

The OpenSSH version is 6.6.1p1

Thanks
 
Old 10-28-2016, 04:49 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,721

Rep: Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914
The syntax is the same, /etc/ssh/ssh_config is the system-wide configuration and ~/.ssh/config is the users configuration file.

As far as I know the ssh client will always use the default port (22) unless it is specified on the command line with the -p option or as configured in a config file.

Quote:
I'm sure I set the config and sshd_config files to 'port ****'.
Where or how did you set the config file? We assume it is your clients user ~/.ssh/config file but some clarification is required.
 
Old 10-29-2016, 02:21 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,314
Blog Entries: 3

Rep: Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723
Yes, the syntax for both client configuration files is the same. If you had a newer version of the client you could use the -G option to see your configuration settings for that specific connection.

However with 6.6.1p1 you'll have to walk through it manually and work the final constellation out in your head, if you don't want to post parts here. The options are applied on a first match basis and they are looked for first among the command-line options, next inside the user configuration file (usually ~/.ssh/config), and lastly inside the system-wide configuration file (/etc/ssh/ssh_config)
 
Old 10-29-2016, 06:26 AM   #7
sailschooner
LQ Newbie
 
Registered: Jun 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
Thanks for these replies. I set port 2233 in ~/.ssh/config and in /etc/ssh/sshd_config. As far as I remember when I set the network up originally I didn't do anything to /etc/ssh/ssh_config and indeed it is still set to port 22. Yet the other client machines (with port 2233 set) are still ok with the server. They're more or less identical machines and all have the same os on them.

Given the order these files connect in then it seems that's where the problem lies. I'll go through and reset them all and see what happens.

Thanks again
 
  


Reply



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
[SOLVED] IPtables : ssh port forwarding one port to another port issue routers Linux - Networking 7 08-07-2018 08:41 AM
How to change SSH port 22 to new one and make Linux system know the new SSH port? sscn Linux - Newbie 16 10-12-2016 11:22 AM
Port number used by server when using dynamic port forwarding in SSH? kreeder Linux - Networking 4 11-21-2011 02:07 PM
Howto do Secured ssh from port https or port80(standard) to ssh d listening port 22 ? Xeratul Linux - General 4 11-23-2006 06:09 AM
iptables help! DROP ssh port, but allow to connect to ssh if from 2222 port kandzha Linux - Networking 4 09-13-2006 09:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:34 PM.

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
Open Source Consulting | Domain Registration