1. CentOS7
[ TELNET 서버 ]
# xinetd : 슈퍼데몬 => 다양한 서비스들의
# 메모리 항상 상주하는 것이 아니 호출되었을 경우
# 서비스를 실행하고 다시 종료하여 주는 방식
# telnet은 xinetd의 하위 종속 데몬이다.
yum -y install xinetd telnet-server
# log_on_failure : 로그온 실패에 대한 로그정보로 USERID를 제공
cat <<TELNET_SETTING > /etc/xinetd.d/telnet
service telnet
{
$(printf '\t')disable = no
$(printf '\t')flags = REUSE
$(printf '\t')socket_type = stream
$(printf '\t')wait = no
$(printf '\t')user = root
$(printf '\t')server = /usr/sbin/in.telnetd
$(printf '\t')log_on_failure += USERID
}
TELNET_SETTING
# 외부 터미널에서 root 접속 가능하도록 설정
sed -i "s/^\s*pts.*//g" /etc/securetty
cat <<TELNET_SETTING >> /etc/securetty
pts/1
pts/2
pts/3
pts/4
pts/5
pts/6
pts/7
pts/8
TELNET_SETTING
systemctl restart xinetd
firewall-cmd --permanent --add-port=23/tcp
firewall-cmd --reload
firewall-cmd --list-all
[ 클라이언트 ]
echo Input Your Telnet Server :
TELNET_SERVER_IP=192.168.108.20 # read TELNET_SERVER_IP
# telnet 클라이언트 설치
yum -y install telnet
# telnet 접속 확인을 위한 패스워드 전달
yum -y install expect
expect <<EOF
spawn telnet -l root ${TELNET_SERVER_IP}
expect "Password:"
send "P@ssw0rd!\n"
send "ip route\n"
send "exit\n"
expect eof
EOF
2. Ubuntu20
[ TELNET 서버 ]
# xinetd : 슈퍼데몬 => 다양한 서비스들의
# 메모리 항상 상주하는 것이 아니 호출되었을 경우
# 서비스를 실행하고 다시 종료하여 주는 방식
# telnet은 xinetd의 하위 종속 데몬이다.
apt-get -y install xinetd telnetd
# log_on_failure : 로그온 실패에 대한 로그정보로 USERID를 제공
cat <<TELNET_SETTING > /etc/xinetd.d/telnet
service telnet
{
$(printf '\t')disable = no
$(printf '\t')flags = REUSE
$(printf '\t')socket_type = stream
$(printf '\t')wait = no
$(printf '\t')user = root
$(printf '\t')server = /usr/sbin/in.telnetd
$(printf '\t')log_on_failure += USERID
}
TELNET_SETTING
sed -i "s/.*pam_securetty.so.*//g" /etc/pam.d/login
echo -e "auth\trequired\tpam_securetty.so" >> /etc/pam.d/login
cp /usr/share/doc/util-linux/examples/securetty /etc/securetty
# 외부 터미널에서 root 접속 가능하도록 설정
sed -i "s/^\s*pts.*//g" /etc/securetty
cat <<TELNET_SETTING >> /etc/securetty
pts/1
pts/2
pts/3
pts/4
pts/5
pts/6
pts/7
pts/8
TELNET_SETTING
systemctl restart xinetd
ufw allow 23/tcp
ufw status
[ 클라이언트 ]
echo Input Your Telnet Server :
TELNET_SERVER_IP=192.168.108.20 # read TELNET_SERVER_IP
# telnet 클라이언트 설치
apt-get -y install telnet
# telnet 접속 확인을 위한 패스워드 전달
apt-get -y install expect
expect <<EOF
spawn telnet -l root ${TELNET_SERVER_IP}
expect "Password:"
send "P@ssw0rd!\n"
send "ip route\n"
send "exit\n"
expect eof
EOF
'Operating Systems > Linux' 카테고리의 다른 글
[ Linux ] TOMCAT 서버 설치 (0) | 2021.08.01 |
---|---|
[ Linux ] SSH 서버 설치 (0) | 2021.07.31 |
[ Linux ] KERBEROS 서버 설치 (0) | 2021.07.30 |
[ Linux ] RPM 패키지 생성 (0) | 2021.07.26 |
[ Linux ] MAIL 서버 설치 (0) | 2021.07.24 |