Dec 15

Experiment with SSH and TCP Wrappers

The idea was :

use two servers; server1, and server2
create user: user1 in both server1 and server2
use nmtui to assign IP Addresses to both
use ifdown and ifup to check if IPs are assigned properly
change /etc/hosts and add the server ips and names
use ping to know that you can reach each other
use ssh-key gen to create key files
use ssh-copy-id to transfer public key file to remote hosts
then use ssh commands to reach to without passwords
try scp and sftp : to copy files/folder to and from

Then use TCP wrappers to allow or deny remote hosts, users, or domains


2 useradd user1
3 passwd user1
4 ip addr
5 nmtui
6 vim /etc/hosts
7 ping server2
8 ip addr
9 nmtui
10 ifdown ens33
11 ifup ens33
12 ping
13 vim /etc/hosts
14 ping server2
15 su user1

1 ssh server2 /bin/ls -l
2 scp file1 server2:
3 touch file1
4 scp file1 server2:
5 scp server2:/usr/bin/zip .

7 sftp server2
8 su root

10 w
11 last

13 tail /var/log/secure

15 sudo tail /var/log/secure

19 getcwd

24 ssh-keygen

27 ssh-copy-id -i ~/.ssh/ server2

31 vim .ssh/authorized_keys
32 ssh server2


TCP wrappers

/etc/hosts.allow : to allow to services from whom
/etc/hosts.allow : to deny to services from whom

Install TCP Wrappers. I used rpm as I turned off internet in the VMware workstation I used

27 rpm -ivh tcp_wrappers*
28 yum info tcp_wrappers
29 ls /etc/hosts.allow
30 vim /etc/hosts.allow
30 vim /etc/hosts.allow

example rules on hosts.allow

All Except sshd:

Skip to toolbar