home_server:home_server_setup:other_services:ssh

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
home_server:home_server_setup:other_services:ssh [2022-06-26 Sun wk25 16:18] baumkphome_server:home_server_setup:other_services:ssh [2023-12-10 Sun wk49 13:16] baumkp
Line 1: Line 1:
 +{{tag>linux debian ubuntu 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]]   *[[How to manage SSH login message|https://www.simplified.guide/ssh/suppress-banner]]
   *[[HowTo: Set a Warning Message (Banner) in SSH|https://www.shellhacks.com/setup-warning-message-banner-ssh/]]   *[[HowTo: Set a Warning Message (Banner) in SSH|https://www.shellhacks.com/setup-warning-message-banner-ssh/]]
  • /app/www/public/data/pages/home_server/home_server_setup/other_services/ssh.txt
  • Last modified: 2023-12-26 Tue wk52 11:38
  • by baumkp