Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
home_server:home_server_setup:other_services:ssh [2022-06-26 Sun wk25 16:18] baumkphome_server:home_server_setup:other_services:ssh [2025-01-10 Fri wk02 10:59] (current) – [Some Links:] baumkp
Line 1: Line 1:
 +{{tag>linux debian ssh "ssh notes"}}
 ======SSH Notes====== ======SSH Notes======
  
Line 13: Line 13:
  
 ====Login Scripts==== ====Login Scripts====
 +====Debian====
   *''ls -la /etc/update-motd.d/'' to see the scripts that are run after the MOTD is displayed.   *''ls -la /etc/update-motd.d/'' to see the scripts that are run after the MOTD is displayed.
 The Debian script is very simple:  The Debian script is very simple: 
-<code>+<code bash>
 #!/bin/sh #!/bin/sh
 uname -snrvm uname -snrvm
 </code> </code>
 +
 +====Ubuntu====
 Ubuntu has multiple scripts some that I like and some that I do not like.   Ubuntu has multiple scripts some that I like and some that I do not like.  
 This system status information script, ++++/etc/update-motd.d/50-landscape-sysinfo| This system status information script, ++++/etc/update-motd.d/50-landscape-sysinfo|
Line 70: Line 73:
 ++++ ++++
  
 +====Python Code====
 +++++python3 agnostic code | 
 <code> <code>
 #!/usr/bin/python3 #!/usr/bin/python3
Line 80: Line 85:
 import uuid import uuid
 import re import re
- 
  
 def get_size(bytes, suffix="B"): def get_size(bytes, suffix="B"):
Line 107: Line 111:
     print(f"Ip-Address: {socket.gethostbyname(socket.gethostname())}")     print(f"Ip-Address: {socket.gethostbyname(socket.gethostname())}")
     print(f"Mac-Address: {':'.join(re.findall('..', '%012x' % uuid.getnode()))}")     print(f"Mac-Address: {':'.join(re.findall('..', '%012x' % uuid.getnode()))}")
- 
  
     # Boot Time     # Boot Time
Line 114: Line 117:
     bt = datetime.fromtimestamp(boot_time_timestamp)     bt = datetime.fromtimestamp(boot_time_timestamp)
     print(f"Boot Time: {bt.year}/{bt.month}/{bt.day} {bt.hour}:{bt.minute}:{bt.second}")     print(f"Boot Time: {bt.year}/{bt.month}/{bt.day} {bt.hour}:{bt.minute}:{bt.second}")
- 
  
     # print CPU information     # print CPU information
Line 131: Line 133:
         print(f"Core {i}: {percentage}%")         print(f"Core {i}: {percentage}%")
     print(f"Total CPU Usage: {psutil.cpu_percent()}%")     print(f"Total CPU Usage: {psutil.cpu_percent()}%")
- 
  
     # Memory Information     # Memory Information
Line 141: Line 142:
     print(f"Used: {get_size(svmem.used)}")     print(f"Used: {get_size(svmem.used)}")
     print(f"Percentage: {svmem.percent}%")     print(f"Percentage: {svmem.percent}%")
- 
- 
  
     print("="*20, "SWAP", "="*20)     print("="*20, "SWAP", "="*20)
Line 151: Line 150:
     print(f"Used: {get_size(swap.used)}")     print(f"Used: {get_size(swap.used)}")
     print(f"Percentage: {swap.percent}%")     print(f"Percentage: {swap.percent}%")
- 
- 
  
     # Disk Information     # Disk Information
Line 197: Line 194:
     print(f"Total Bytes Sent: {get_size(net_io.bytes_sent)}")     print(f"Total Bytes Sent: {get_size(net_io.bytes_sent)}")
     print(f"Total Bytes Received: {get_size(net_io.bytes_recv)}")     print(f"Total Bytes Received: {get_size(net_io.bytes_recv)}")
- 
  
 if __name__ == "__main__": if __name__ == "__main__":
Line 203: Line 199:
     System_information()     System_information()
 </code> </code>
 +++++
  
-Some Links: +====Some Links:==== 
-  *[[How to manage SSH login message|https://www.simplified.guide/ssh/suppress-banner]] +  *[[https://www.simplified.guide/ssh/suppress-banner|How to manage SSH login message]] 
-  *[[HowTo: Set a Warning Message (Banner) in SSH|https://www.shellhacks.com/setup-warning-message-banner-ssh/]] +  *[[https://www.shellhacks.com/setup-warning-message-banner-ssh/|HowTo: Set a Warning Message (Banner) in SSH]] 
-  *[[Protect SSH Logins with SSH & MOTD Banner Messages|https://www.tecmint.com/protect-ssh-logins-with-ssh-motd-banner-messages/]]+  *[[https://www.tecmint.com/protect-ssh-logins-with-ssh-motd-banner-messages/|Protect SSH Logins with SSH & MOTD Banner Messages]]
  
 <- home_server:home_server_setup:other_services:webmin|Prev ^ home_server:home_server_setup:other_services:index|Start page ^ home_server:home_server_setup:other_services:bash|Next -> <- home_server:home_server_setup:other_services:webmin|Prev ^ home_server:home_server_setup:other_services:index|Start page ^ home_server:home_server_setup:other_services:bash|Next ->