「Linux」Banner Configuration

8/29/2022 Linux

# Pains

- Kraft has many different environments for Linux servers in daily work.       
- Kraft does not have a clearly visible backend management tool.    
- Kraft has a very bad memory
1
2
3

# What's SSH Banner

__|  __|_  )
_|  (     /   Amazon Linux 2 AMI
___|\___|___|
1
2
3

# How to work

MOTD(5)                                Linux Programmer's Manual                                

NAME
motd - message of the day

DESCRIPTION
The  contents of /etc/motd are displayed by login(1) after a successful login but just before it
executes the login shell.

The abbreviation "motd" stands for "message of the day", and this file  has  been  traditionally
used for exactly that (it requires much less disk space than mail to all users).

FILES
/etc/motd

SEE ALSO
login(1), issue(5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# TODO

kraft@Kraft-Server:~$ ssh ec2
Last login: Tue Aug 30 09:22:38 2022 from 114.251.173.133
Tue Aug 30 09:14:43 UTC 2022
=============================================================================
	| |/ / _ \  /_\ | __|_   _| 
	| ' <|   / / _ \| _|  | |   Deep Learning Instance
	|_|\_\_|_\/_/ \_\_|   |_|
=============================================================================

Use one of the following commands to start the required environment with framework of your choice:
Tensorflow 1.15 with Python3.7 (CUDA 10.0 and Intel MKL-DNN)  source activate tensorflow_1.15 
Tensorflow 2.3 (+Keras2) with Python3.7 (CUDA 10.1 and Intel MKL-DNN) source activate tensorflow_2.3 
PyTorch 1.7.1 with Python3.7 (CUDA 11.0 and Intel MKL) source activate pytorch_1.7
PyTorch 1.8.1 with Python3.7 (CUDA 11.1 and Intel MKL) source activate pytorch_1.8
[root@Kraft ~]# 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# Advanced

The above method can put static information directly in /etc/motd, but when want to execute some commands to get more information, it does not seem to support. So can use update-motd. Place the script under /etc/update-motd.d/ to ensure that the script is executable.

kraft@Kraft-Server:~$ ssh ec2
Last login: Tue Aug 30 09:23:00 2022 from 114.251.173.133
Tue Aug 30 09:14:43 UTC 2022
=============================================================================
	| |/ / _ \  /_\ | __|_   _| 
	| ' <|   / / _ \| _|  | |   Deep Learning Instance
	|_|\_\_|_\/_/ \_\_|   |_|
=============================================================================

Use one of the following commands to start the required environment with framework of your choice:
Tensorflow 1.15 with Python3.7 (CUDA 10.0 and Intel MKL-DNN) source activate tensorflow_1.15 
Tensorflow 2.3 (+Keras2) with Python3.7 (CUDA 10.1 and Intel MKL-DNN) source activate tensorflow_2.3 
PyTorch 1.7.1 with Python3.7 (CUDA 11.0 and Intel MKL) source activate pytorch_1.7
PyTorch 1.8.1 with Python3.7 (CUDA 11.1 and Intel MKL) source activate pytorch_1.8

Tue Aug 30 09:14:44 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.47.03    Driver Version: 510.47.03    CUDA Version: 11.6     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla T4            Off  | 00000000:00:1E.0 Off |                    0 |
| N/A   65C    P0    30W /  70W |      0MiB / 15360MiB |     11%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
[root@Kraft ~]# 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Last Updated: 2023-05-10 01:49:43