I don't understand why this question was closed without answer, and getting 4 down voted?
I want to use tcp wrapper to disable ssh remote login from a client on the server. How do I find out if sshd supports tcp wrapper and hence use it to disable ssh login?
closed as unclear what you're asking by Tom Hunt, cuonglm, Scott, chaos, Archemar Dec 2 '15 at 8:17
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
I wanted to answer it, however since it's already been closed, I can't do that. Anyway, here is the answer.
A TCP wrapped service is one that has been compiled against the libwrap.a library. Use the ldd command to determine whether a network service is linked to libwrap.a. The following example determines the absolute path name of the sshd service, and then lists the shared libraries linked to the sshd service, using the grep command to search for the libwrap library:
[root@localhost ~]# whereis sshd sshd: /usr/sbin/sshd /usr/share/man/man8/sshd.8.gz [root@localhost ~]# [root@localhost ~]# ldd /usr/sbin/sshd | grep libwrap libwrap.so.0 => /lib64/libwrap.so.0 (0x00007f506b6e2000) [root@localhost ~]#
If the file is not supported, you won't be able to see
ldd command. Example
[root@localhost ~]# ldd /usr/sbin/sshd | grep libwrap [root@localhost ~]#
Initially, I was able to ssh to this box (10.1.1.1).
user@PC02:~$ ssh firstname.lastname@example.org email@example.com's password: [root@PC01 ~]#
To block SSH access from PC02 (10.1.1.2), just edit
/etc/hosts.deny file on PC01 (10.1.1.1) as follow.
[root@PC01 ~]# cat /etc/hosts.deny sshd : 10.1.1.2 [root@PC01 ~]#
Then, If you try to access it again ...
user@PC02:~$ ssh 10.1.1.1 ssh_exchange_identification: read: Connection reset by peer user@PC02:~$
I hope this answer will help Mercy E and other users.
I'm new here and having the same problem too. E.g. my post here was down voted without any explanation, no comment, no answer ... nothing ...
Let's make stackexchange and stackoverflow more welcoming as mentioned by Jay Hanlon in his blog post here.