0

I am using sles-12 server and i am trying to restrict ssh access to my server to my pc alone. I have tried to use tcpwrappers and it's not working..!!. I am able to ssh to the server from any IP in my local network.

I have tried different formats from man page to see if anything is working but to no effect. Here is the files I have used for setting the wrappers and commands which might be useful

[root@myserver ~]# cat /etc/hosts.allow
sshd:172.19.112.120
[root@myserver ~]# cat /etc/hosts.deny
sshd:ALL
[root@myserver ~]#  tcpdmatch -d -i /etc/xinetd.conf sshd 135.250.164.106 --> another server
client:   hostname paranoid
client:   address  135.250.164.106
server:   process  sshd
access:   granted  --> NOT OK
[root@myserver ~]#
[root@myserver ~]# ldd /usr/sbin/sshd | grep 'libwrap'
        libwrap.so.0 => /lib64/libwrap.so.0 (0x00007fa2b71f7000)

PS: IP table restrictions are working fine. But I can't use it in my scenario. and no specific configurations are done in /etc/ssh/ssh_config

  • I have found the problem on why it's not working. I am using openssh v 7.2 and tcpwrappers support is removed from openssh from version 6.7 onwards. Link --> openssh.com/releasenotes.html (Check release notes of version 6.7). – Ajay Joseph Dec 6 '18 at 11:22
0

Infact we can do it with sshd_config file in /etc/ssh/sshd_config

I used the parameter Allowusers in format AllowUsers admin@ and it worked fine. We can add more users or IPs as per need.

Reference: https://linux.die.net/man/5/sshd_config

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.