LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-02-2021, 04:43 AM   #1
avner.sib
LQ Newbie
 
Registered: Feb 2021
Posts: 4

Rep: Reputation: Disabled
sshd configuration with match and 2 record


Hi All,

I have a issue with hostname and ssh resolver.
I'm config ssh match with Address.
but the a target server has 2 A Record, And he always checks only one.


getent hosts 172.16.50.1
172.16.50.1 bb.lian.co.il cc.lian.co.il

Feb 2 05:17:46 zabbix-agentless sshd[2126348]: debug1: PAM: initializing for "root"
Feb 2 05:17:46 zabbix-agentless sshd[2126348]: debug1: PAM: setting PAM_RHOST to "bb.lian.co.il"
 
Old 02-02-2021, 11:53 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
If you have a question, please formulate it. It's not quite clear to me what you want.
 
Old 02-04-2021, 01:53 PM   #3
avner.sib
LQ Newbie
 
Registered: Feb 2021
Posts: 4

Original Poster
Rep: Reputation: Disabled
I'll try to explain.
When I'm configure sshd service with section of match.
Example.
Match host aaaa.domain.com
Rootlogin yes

But to an aaaa host has 2 record. so the ssh always get only one, and I want to use the second record
 
Old 02-06-2021, 07:13 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I would try

Code:
match host 172.16.50.1
or

Code:
match host bb.lian.co.il cc.lian.co.il
 
Old 02-06-2021, 08:42 PM   #5
avner.sib
LQ Newbie
 
Registered: Feb 2021
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks for reply.

It's was only example, of course I used this syntax.
that is not the question
BTW
if you want to use with ip the code is
match address,
there is a different

Last edited by avner.sib; 02-06-2021 at 08:43 PM.
 
Old 02-07-2021, 12:22 AM   #6
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
You could try the following:

Code:
Match Address 192.168.1.100
        PermitRootLogin yes
This way you can leave PremitRootLogin set to 'no'.

But that would allow anyone connecting to that IP to login as root. Root login is a bad idea and you really shouldn't allow it. Make everyone log in with their user account and then switch to root using either 'su -' or 'sudo'.
 
Old 02-07-2021, 01:31 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ Agreed.

I'm confused by the conflagration of DNS and SSH here.
I understand the connection and issue now, but these are two separate things and should be considered separately.
Quote:
Originally Posted by avner.sib View Post
host has 2 record. so the ssh always get only one, and I want to use the second record
Why don't you just ssh to cc.lian.co.il instead of the numerical IP?
Or use cc.lian.co.il instead of the numerical IP in your sshd_config?
 
Old 02-07-2021, 04:50 AM   #8
avner.sib
LQ Newbie
 
Registered: Feb 2021
Posts: 4

Original Poster
Rep: Reputation: Disabled
Because I want to use in cname record,
And not with hostname of computer.
 
Old 02-07-2021, 05:07 AM   #9
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
So if I understand correctly, you have several names that resolve in DNS to the same IP address, but you would like only one of the names to be acknowledged by the SSH server?

Code:
Match Address nametwo.example.com
 ...
Perhaps instead of using match ... you could try allowusers ... with a FQDN. I have not tried it but from the documentation it should look something like this:

Code:
AllowUsers avner@nametwo.example.com
See "man sshd_config" and scroll down to "AllowUsers"

Don't lock yourself out during the testing, though. Be sure to have another means of accessing the system while you adjust the configuration file.

Last edited by Turbocapitalist; 02-07-2021 at 05:09 AM.
 
  


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
How to capture 1000 lines before a string match and 1000 line a string match including line of string match ? sysmicuser Linux - Newbie 12 11-14-2017 05:21 AM
Starting sshd: /etc/init.d/sshd: line 113: /usr/sbin/sshd: Permission denied sumanc Linux - Server 5 03-28-2008 04:59 AM
FC4-Starting sshd: Privilege separation user sshd does not exist FAILED kiranherekar Fedora 5 12-29-2005 02:22 PM
Enabling SSH in mandrake 9.2 - sshd vs. sshd-xinetd DogTags Linux - Newbie 7 11-25-2003 12:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:04 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
Open Source Consulting | Domain Registration