본문 바로가기
Linux/Ubuntu

[SSH] ssh나 telnet 접속시 메시지 띄우기

by 어발 2021. 8. 3.

1. /etc 경로에 motd파일 작성

2. /etc/sshd/sshd_config 파일 수정

# PrintMotd no
PrintMotd yes

motd파일 생성하는 sh파일

#!/bin/bash

#define the filename to use as output
motd="./motd"

# Collect useful information about your system
# $USER is automatically defined
HOSTNAME=`uname -n`
KERNEL=`uname -r`
CPU=`uname -p`
ARCH=`uname -m`

# The different colours as variables
Black="\033[0;30m"
Red="\033[0;31m"
Green="\033[0;32m"
Blue="\033[0;33m"
Purple="\033[0;34m"
Cyan="\033[0;35m"
Silver="\033[0;36m"
DarkGray="\033[1;30m"
LightBlue="\033[1;34m"
LightGreen="\033[1;32m"
LightCyan="\033[1;36m"
LightRed="\033[1;31m"
Yellow="\033[1;33m"
White="\033[1;37m"
X="\033[0;0m"

clear > $motd # to clear the screen when showing up
echo -e "$Red#=============================================================================#" >> $motd
echo -e "   $White Welcome $Blue $USER $White to $Blue $HOSTNAME                " >> $motd
echo -e "   $Red ARCH   $White= $ARCH                                   " >> $motd
echo -e "   $Red KERNEL $White= $KERNEL                                 " >> $motd
echo -e "   $Red CPU    $White= $CPU                                    " >> $motd
echo -e "$Red#=============================================================================#" >> $motd
echo -e "$Yellow

This is a server to treat the personal information.
If you have access to this server with unjustified way, you can receive legal penalty.
Only your activities are allowed within the authority granted to you, and you can receive legal penalty for breaching it.
You here all the activities are being recorded.
In case of any problems, please feel free to contact abc@abc.com.
(Tel. 010-0000-0000)" >> $motd

echo -e "$X" >> $motd
728x90

댓글