1

I don't think my needs are all that unique. I have a home network wired and wireless with multiple devices running Ubuntu 16.04.6 LTS. They will be upgraded to 20.04 soon though. My desire is to setup each device both as a Client AND Server to every other device. Currently I have:

  • Dell Inspiron 17R SE 7720 laptop
  • Dell Alienware 17R3 laptop
  • Same user name on both machines

I'm looking for a script that will install and configure ssh or openssh-client AND openssh-server on both machines. This assumes ssh includes both client and server.

The script will:

  1. Remove ssh if already installed. (This may not be necessary I guess...)
  2. Install ssh and trigger sshd to run by systemd.
  3. Name the machine in /etc/hosts or /etc/resolve or where ever network names are needed.
  4. Setup the static IP's wherever static IP's are setup.
  5. Create the keys whereever keys are setup.
  6. Block out access to any device not on LAN.
  7. Automatically prevent snooping or spoofing or whatever sping there is to prevent.
  8. Set current machine up as valid client to all other machines (who are also servers) on the LAN. Probably involves copying SSH client keys.
  9. Ask Ubuntu Q&A: Automatically change Terminal colors on remote connection?

Do everything else required per internet articles:

Calling the script should be straight forward with:

sudo ssh-setup HOST_NAME USER_NAME

Again the machine is setup as both a server and a client. Initially I'll just have two laptops. Later on I'll want to add my Linux Kernel based phones and TV's running Android. Initially all machines will just have the single user ID.

Is there a script already out there or do I have to write my own?


June 13, 2020 update

I've begun writing a script but it will take at least a week to complete.

8
  • 1
    I have not seen anything like it in the wild.
    – user535733
    Jun 14, 2020 at 3:48
  • 2
    Step 2 is done automatically when you install sshd.Step 6 can be done via iptables.You can list all the ssh keys in the system via "ssh_add -l" . You can set static IP address using netplan.Penultimate step is actually not one step , it's quite complicated . For more information see this.I think the rest is straightforward Jun 14, 2020 at 17:42
  • @ParsaMousavi netplan is not installed on Ubuntu 16.04.6 LTS by default. I could install it but I think that might open a can of worms? I've placed my static IP addresses into /etc/hosts but I'm not sure if this is where netplan places them too? Jun 14, 2020 at 18:10
  • 2
    @WinEunuuchs2Unix No , the default file was /etc/network/interfaces before netplan found its way in ubuntu. And now it's something like this : /etc/netplan/01-network-manager-all.yaml You said you want to upgrade to 20.04 and there the default option is netplan. So it can be forward-compatible to use netplan instead of the default one in 16.04. And AFAIK /etc/hosts is just for DNS resolution ( some kind of permanent local cache). Jun 14, 2020 at 18:23
  • 2
    @WinEunuuchs2Unix Because that's for custom additional interfaces , not the ones that are detected by your system (i.e udev). Jun 14, 2020 at 18:31

1 Answer 1

1

Introduction

My final script (ssh-setup) is done and SSH Open Server has been installed. The script doesn't do as much as originally envisioned. Someone can take it and modify it for automated setup in a large organization though. For everyone else it hopefully provides useful details to aid in installation.

Before raising concerns about MAC addresses below note that:

Says:

MAC addresses are almost always only used "internally" (between you and your immediate gateway). They really don't make it to the outside world and thus cannot be used to connect back to you, locate you, or otherwise cause you any direct harm.


ssh-setup Sample Output

$ sudo ssh-setup

Gathering system details - Will take 15 - 30 seconds
 
==========  systemctl status net*  ============================================
 
* network-online.target - Network is Online
      (... OUTPUT SNIPPED TO SAVE SPACE ...)
* networking.service - Raise network interfaces
      (... OUTPUT SNIPPED TO SAVE SPACE ...)
* network.target - Network
      (... OUTPUT SNIPPED TO SAVE SPACE ...)
* network-pre.target - Network (Pre)
      (... OUTPUT SNIPPED TO SAVE SPACE ...)
 
==========  systemctl status ssh  =============================================
 
* ssh.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
 
==========  [[ -d ~/.ssh ]] && SSH_Keys=$(ls -al ~/.ssh)  =====================
 
-rw-------  1 rick rick 1679 Oct  8  2019 id_rsa
-rw-r--r--  1 rick rick  392 Oct  8  2019 id_rsa.pub
-rw-r--r--  1 rick rick 1108 Jun 17 20:53 known_hosts
 
==========  apt list 2>/dev/null | grep ssh | grep installed  =================
 
libssh-4/xenial-updates,xenial-security,now 0.6.3-4.3ubuntu0.5 amd64
libssh-gcrypt-4/xenial-updates,xenial-security,now 0.6.3-4.3ubuntu0.5 amd64
libssh2-1/xenial-updates,xenial-security,now 1.5.0-2ubuntu0.1 amd64
openssh-client/xenial-updates,xenial-security,now 1:7.2p2-4ubuntu2.8 amd64
sshfs/xenial,now 2.5-1ubuntu1 amd64
 
==========  cat /etc/ssh/sshd.config  =========================================
 

 
==========  ifconfig -a | grep -v ^' ' -A1  ===================================
 
enp59s0   Link encap:Ethernet  HWaddr 28:f1:0e:2a:1a:ed  
          inet addr:192.168.0.12  Bcast:192.168.0.255  Mask:255.255.255.0

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0

wlp60s0   Link encap:Ethernet  HWaddr 9c:b6:d0:10:37:f7  
          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
 
==========  nmap -sn 192.168.0/24  ============================================
 

hitronhub.home (192.168.0.1) (0.0011s latency). MAC: AC:20:2E:CC:94:52 (Unknown)
dell (192.168.0.13) (0.00026s latency). MAC: 5C:F9:DD:5C:9C:53 (Dell)
dell (192.168.0.14) (0.00026s latency). MAC: 5C:F9:DD:5C:9C:53 (Dell)
hs100 (192.168.0.15) (-0.078s latency). MAC: 50:D4:F7:EB:41:35 (Unknown)
android-47cdabb50f83a5ee (192.168.0.16) (-0.076s latency). MAC: 18:4F:32:8D:AA:97 (Hon Hai Precision Ind.)
192.168.0.254 (0.00045s latency). MAC: 00:05:CA:00:00:09 (Hitron Technology)
alien (192.168.0.10) LOCAL NETWORK CARD
alien (192.168.0.12) LOCAL NETWORK CARD

                          
==========  lshw -c network | grep -Ei 'description|product|serial'  ==========
 
Ethernet interface: Killer E2400 Gigabit Ethernet Controller - 28:f1:0e:2a:1a:ed
Wireless interface: QCA6174 802.11ac Wireless Network Adapter - 9c:b6:d0:10:37:f7
 
==========  cat /etc/hosts | grep 192.168  ====================================
 
192.168.0.10    alien  AW 17R3 WiFi                   9c:b6:d0:10:37:f7
192.168.0.12    alien  AW 17R3 Ethernet               28:f1:0e:2a:1a:ed
192.168.0.13    dell   Inspiron 17R-SE-7720 Ethernet  5c:f9:dd:5c:9c:53
192.168.0.14    dell   Inspiron 17R-SE-7720 WiFi      60:6c:66:86:de:bd
192.168.0.15    hs100  Sony TV Wall Light
192.168.0.16    android-47cdabb50f83a5ee  Sony Bravia TV KBL 50W800C
 
==========  FIREWALL: ufw status verbose  =====================================
 
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
-------------- Any error messages below are coming from tlp-stat --------------
cat: /sys/class/power_supply/hidpp_battery_35/present: No such file or directory
cat: /sys/class/power_supply/hidpp_battery_36/present: No such file or directory
 
==========  tlp-stat | grep -E '^autosuspend|ENABLE|WOL'  =====================
 
TLP_ENABLE=1
WOL_DISABLE=Y
autosuspend        = enabled
 
==========  cat /etc/default/halt  ============================================
 
# Default behaviour of shutdown -h / halt. Set to "halt" or "poweroff".
HALT=poweroff
 
==========  cat /etc/network/interfaces  ======================================
 
# interfaces(5) file used by ifup(8) and ifdown(8)
# /etc/network/interfaces
# For Ubuntu 16.04 ONLY according to notes in ssh-setup
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.0.10
        netmask 255.255.255.0
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1
        up ethtool -s eth0 wol g
 
==========  nmcli -p connection show  =========================================
 
====================================================================================
                         NetworkManager connection profiles
====================================================================================
NAME                UUID                                  TYPE             DEVICE  
------------------------------------------------------------------------------------
XXXX-XXXXXX-5G      cf8fda92-0e59-4d0e-8821-cedb4be10d26  802-11-wireless  wlp60s0 
Wired connection 1  378122bb-ad44-3ddd-a616-c93e1bf0f828  802-3-ethernet   enp59s0 
XXXXXXXXX-5G        73c40a50-0f2e-431c-b12c-e4712b3abdb4  802-11-wireless  --      
 
==========  ifconfig -a | grep ^'e' | cut -d' ' -f1  ==========================
 
Ethernet Interface that could be used for WOL:   enp59s0
 
==========  ethtool enp59s0 | grep -i 'Wake-on:'  =============================
 

 
==========  END OF REPORT  ====================================================

Although the report is long already it could be made even longer with explanations for each section. The explanations including links are in the actual script itself.


ssh-setup Bash Script

The script must be called with sudo powers. The same script is designed to be run on both the server and client. Some files such as /etc/hosts you will need to setup after running the report and then copy (perhaps by email) between machines.

After creating the script in a directory, remember to mark it executable with:

chmod a+x /path/to/ssh-setup

Then call the script with sudo /path/to/ssh-setup or simply ssh-setup if the /path/to/ is in your PATH environment variable. Where: /path/to/ is the folder you created the script in.

#!/bin/bash

# NAME: ssh-setup
# PATH: /mnt/e/bin
# DESC: Display network details needed to setup SSH or debug after setup.
# CALL: Called from terminal with `sudo` permissions.
# DATE: June 18, 2020. Modified: Original Version.

# NOTE: When debugging script place terminal results in appropriate sections.

# From: https://askubuntu.com/questions/628383/output-only-mac-address-on-ubuntu#comment892989_628387

export LANG=C       # Force english names for sed search. For example in
                    # another language HWaddr is direcciónHW

if [[ $(id -u) != 0 ]]; then # root powers needed to call this script
    echo >&2 "'$(basename $0)' must be called with 'sudo'"
    exit 1
fi

# Must have the nmap package.
command -v nmap >/dev/null 2>&1 || { echo >&2 \
        "'nmap' package required but it is not installed.  Aborting."; \
        exit 2; }

# Must have the lshw package.
command -v lshw >/dev/null 2>&1 || { echo >&2 \
        "'lshw' package required but it is not installed.  Aborting."; \
        exit 3; }

# OTHER PACKAGES CONSIDERED AND REJECTED:

# $ network-test
# The program 'network-test' is currently not installed. You can install it
# by typing: 'sudo apt install ifupdown-extra'
# Seems kind of lame and has md5 checksum error.

# $ netstat | wc -l
# 824
# Way to many lines to make use of. Might be good to track down specific addy.

# $ iwconfig
# wlp60s0   IEEE 802.11  ESSID:"XXXXXXXXXXXXXX"  
#           Mode:Managed  Frequency:5.22 GHz  Access Point: AE:20:2E:CC:94:50   
#           Bit Rate=6 Mb/s   Tx-Power=23 dBm
# Reveals router name (EESID) which is bad for neighbours to know us by....

echo
echo "Gathering system details - Will take 15 - 30 seconds"

Display () {

# $1 = command that was run (sometimes abridged version if lots of seds)
# $2 = output from command

echo " "
String1="==========  $1  "
String2="====================================================================="
String3="$String1$String2"
echo "${String3:0:79}"
echo " "
echo "$2"

} # Display

# What systemd network services are running?
NET_Service="" # Default no directory
NET_Service=$(systemctl status net*)
Display 'systemctl status net*' "$NET_Service"

: <<'END'
/* ------------ RESULTS -------------------------------------------------------

(ABRIDGED)

* network-online.target - Network is Online
* networking.service - Raise network interfaces
* network.target - Network
* network-pre.target - Network (Pre)
 
---------------------------------------------------------------------------- */
END
# Is SSH systemd service (aliased as sshd) running?
SSH_Service="" # Default no directory
SSH_Service=$(systemctl status ssh)
Display 'systemctl status ssh' "$SSH_Service"

: <<'END'
/* ------------ RESULTS -------------------------------------------------------

● ssh.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

---------------------------------------------------------------------------- */
END

# What SSH keys are already setup?
SSH_Keys="" # Default no directory
[[ -d ~/.ssh ]] && SSH_Keys=$(ls -al ~/.ssh | \
                              grep -v ^total | \
                              grep -v ^d )
                              # remove total line, ./ and ../ directories
Display '[[ -d ~/.ssh ]] && SSH_Keys=$(ls -al ~/.ssh)' "$SSH_Keys"

: <<'END'
/* ------------ RESULTS -------------------------------------------------------

id_rsa
id_rsa.pub
known_hosts

---------------------------------------------------------------------------- */
END

# What SSH packages are currently installed?
SSH_Installed="" # Default no SSH packages
SSH_Installed=$(apt list 2>/dev/null | grep ssh | grep installed | \
                     sed 's/ \[installed.*//')
                     # remove [installed] & [installed, automatic] strings

Display "apt list 2>/dev/null | grep ssh | grep installed" "$SSH_Installed"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------

libssh-4/xenial-updates,xenial-security,now 0.6.3-4.3ubuntu0.5 amd64
libssh-gcrypt-4/xenial-updates,xenial-security,now 0.6.3-4.3ubuntu0.5 amd64
libssh2-1/xenial-updates,xenial-security,now 1.5.0-2ubuntu0.1 amd64
openssh-client/xenial-updates,xenial-security,now 1:7.2p2-4ubuntu2.8 amd64
sshfs/xenial,now 2.5-1ubuntu1 amd64

---------------------------------------------------------------------------- */
END

# What is the SSH configuration?
SSH_Config="" # Default no SSH packages
[[ -f ~/etc/ssh/sshd.config ]] && SSH_Config=$(cat ~/etc/ssh/sshd.config)
Display "cat /etc/ssh/sshd.config" "$SSH_Config"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------
---------------------------------------------------------------------------- */
END

# What IP address are on this machine?
LOCAL_IP_Addresses="" # Default machine has no network cards
LOCAL_IP_Addresses=$(ifconfig -a | grep -v ^' ' -A1 | \
                     grep -v '\-\-')
                     # grep to -v to remove extra lines
Display "ifconfig -a | grep -v ^' ' -A1" "$LOCAL_IP_Addresses"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------

enp59s0   Link encap:Ethernet  HWaddr 28:f1:0e:2a:1a:ed  
          inet addr:192.168.0.12  Bcast:192.168.0.255  Mask:255.255.255.0

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0

wlp60s0   Link encap:Ethernet  HWaddr 9c:b6:d0:10:37:f7  
          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
 
---------------------------------------------------------------------------- */
END

# What IP address (potential servers/clients) are visible on network?
NET_IP_Addresses="" # Default LAN is not running
NET_IP_Addresses=$(nmap -sn 192.168.0/24 | \
                   sed '/^Starting Nmap/d' | \
                   sed '/^Nmap done/d' | \
                   sed -z 's/Nmap scan report for //g' | \
                   sed -z 's/\nHost is up\./ LOCAL NETWORK CARD/g' | \
                   sed -z 's/\nHost is up / /g' | \
                   sed -z 's/\nMAC Address: / MAC: /g' )
#                   sed 's/MAC.*(/(/g') # MAC makes line too long
                   # Use sed to remove line breaks making results lengthy
Display "nmap -sn 192.168.0/24" "$NET_IP_Addresses"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------

hitronhub.home (192.168.0.1) (0.00072s latency). (Unknown)
dell (192.168.0.13) (0.00021s latency). (Dell)
dell (192.168.0.14) (0.00022s latency). (Dell)
hs100 (192.168.0.15) (0.010s latency). (Unknown)
android-47cdabb50f83a5ee (192.168.0.16) (0.0093s latency). (Hon Hai Precision Ind.)
192.168.0.254 (-0.100s latency). (Hitron Technology)
alien (192.168.0.10) LOCAL NETWORK CARD
alien (192.168.0.12) LOCAL NETWORK CARD

---------------------------------------------------------------------------- */
END

#What network cards are installed:
NetworkCards="" # Contents of /etc/hosts should contain all IP addresses on LAN
NetworkCards=$(lshw -c network | grep -Ei 'description|product|serial' | \
               sed 's/       description: //g' |  \
               sed -z 's/\n       product: /: /g' | \
               sed -z 's/\n       serial: / - /g')
Display "lshw -c network | grep -Ei 'description|product|serial'" "$NetworkCards"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------

Ethernet interface: Killer E2400 Gigabit Ethernet Controller - 28:f1:0e:2a:1a:ed
Wireless interface: QCA6174 802.11ac Wireless Network Adapter - 9c:b6:d0:10:37:f7
 
---------------------------------------------------------------------------- */
END

# Email /etc/hosts file to yourself and update contents below on machine
STATIC_IP_Addresses="" # Contents of /etc/hosts should contain all IP addresses on LAN
STATIC_IP_Addresses=$(cat /etc/hosts | grep 192.168)
Display "cat /etc/hosts | grep 192.168" "$STATIC_IP_Addresses"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------

192.168.0.10    alien  AW 17R3 WiFi                   9c:b6:d0:10:37:f7
192.168.0.12    alien  AW 17R3 Ethernet               28:f1:0e:2a:1a:ed
192.168.0.13    dell   Inspiron 17R-SE-7720 Ethernet  5c:f9:dd:5c:9c:53
192.168.0.14    dell   Inspiron 17R-SE-7720 WiFi      60:6c:66:86:de:bd
192.168.0.15    hs100  Sony TV Wall Light
192.168.0.16    android-47cdabb50f83a5ee  Sony Bravia TV KBL 50W800C


---------------------------------------------------------------------------- */
END

# Firewall
# Selecteend TLP stats that might prove helpful for debuggin.
ufw_stats="" # Contents of /etc/hosts should contain all IP addresses on LAN
ufw_stats=$(ufw status verbose)
Display "FIREWALL: ufw status verbose" "$ufw_stats"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------

Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
-------------- Any error messages below are coming from tlp-stat --------------
cat: /sys/class/power_supply/hidpp_battery_23/present: No such file or directory
cat: /sys/class/power_supply/hidpp_battery_24/present: No such file or directory

---------------------------------------------------------------------------- */
END

echo -------------- \
Any error messages below are coming from tlp-stat --------------
# Selected TLP stats that might prove helpful for debuggin.
TLP_stats="" # Contents of /etc/hosts should contain all IP addresses on LAN
command -v tlp-stat >/dev/null 2>&1 && \
    TLP_stats=$(tlp-stat | grep -E '^autosuspend|ENABLE|WOL')
Display "tlp-stat | grep -E '^autosuspend|ENABLE|WOL'" "$TLP_stats"
: <<'END'

/* ------------ RESULTS -------------------------------------------------------

TLP_ENABLE=1
WOL_DISABLE=Y
autosuspend        = enabled

---------------------------------------------------------------------------- */
END

: <<'END'
/* ------------------  WOL (Wake On LAN) General Comments  --------------------

*******************  UBUNTU 16.04  *******************

From: https://askubuntu.com/questions/764158/
      how-to-enable-wake-on-lan-wol-in-ubuntu-16-04

Also:  http://manpages.ubuntu.com/manpages/xenial/man8/NetworkManager.8.html

In Ubuntu 16.04 set WOL_DISABLE=N in /etc/default/tlp to avoid getting WOL 
disabled by TLP power management.

http://linrunner.de/en/tlp/docs/tlp-configuration.html

Add NETDOWN=no in /etc/default/halt to prevent powering off the network
card during shutdown

Enable Wake on LAN in /etc/network/interfaces when static network 
configuration is used.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface

auto lo
iface lo inet loopback
# The primary network interface

auto eth0
iface eth0 inet static
        address 192.168.0.10
        netmask 255.255.255.0
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1
        up ethtool -s eth0 wol g

Enable wake on lan in BIOS, enter the BIOS setup and look for something
called "Wake up on PCI event", "Wake up on LAN" or similar. Change it so
that it is enabled. Save your settings and reboot.

https://help.ubuntu.com/community/WakeOnLan

Warning some motherboards / network controllers don't support WOL from the
cold boot (S5 state, where the power to the system is physically turned off 
and back on again). In that case, at least one power cycle (power up, 
shutdown) has to be performed. To mitigate to the problem, the BIOS can be 
configured to power up when AC is restored and schedule a shutdown inside 
Ubuntu afterwards. Refer to the motherboard's manual for further details.


*******************  UBUNTU 18.04  *******************


NOTE: In Ubuntu 18.04 /etc/network/interfaces maybe DEPRECATED
      You might have to create your own script for WOL in:
      /etc/NetworkManager/dispatcher.d/99-Xxxxxx
      
      See: https://askubuntu.com/a/1111656/307523
           https://wiki.archlinux.org/index.php/
           NetworkManager#Network_services_with_NetworkManager_dispatcher


---------------------------------------------------------------------------- */
END

# WOL from: https://wiki.debian.org/WakeOnLan
# apt install ethtool
# ethtool -s eth0 wol g

# Above is NOT PERSISTENT across suspend/resume cycle so issue upon resume
# not just boot. /etc/network/interfaces above has setup.

# Archwiki: https://wiki.archlinux.org/index.php/Wake-on-LAN
# apt install wakeonlan
# wol target_MAC_address

# From: https://www.thegeekstuff.com/2008/11/
# wol-wakeonlan-guide-remotely-turn-on-servers-without-physical-access/
# wakeonlan 5c:f9:dd:5c:9c:53

# Do we have 'NETDOWN=no' line present for machines that shutdown"?
HaltConfig="" # Default no file
[[ -f /etc/default/halt ]] && HaltConfig=$(cat /etc/default/halt)
Display 'cat /etc/default/halt' "$HaltConfig"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------

# Default behaviour of shutdown -h / halt. Set to "halt" or "poweroff".
HALT=poweroff

---------------------------------------------------------------------------- */
END

# Do we have static IP addresses setup?
NetworkInterfaces="" # Default no file
[[ -f /etc/network/interfaces ]] && NetworkInterfaces=$(cat /etc/network/interfaces)
Display 'cat /etc/network/interfaces' "$NetworkInterfaces"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------

# interfaces(5) file used by ifup(8) and ifdown(8)
# /etc/network/interfaces
# For Ubuntu 16.04 ONLY according to notes in ssh-setup
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.0.10
        netmask 255.255.255.0
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1
        up ethtool -s eth0 wol g

---------------------------------------------------------------------------- */
END

# Hide your router address below if publishing!
nmcliConnections="" # Default no file
nmcliConnections=$(nmcli -p connection show)
Display 'nmcli -p connection show' "$nmcliConnections"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------

====================================================================================
                         NetworkManager connection profiles
====================================================================================
NAME                UUID                                  TYPE             DEVICE  
------------------------------------------------------------------------------------
Xxxx-Xxxxxx-Xx      cf8fda92-0e59-4d0e-8821-cedb4be10d26  802-11-wireless  wlp60s0 
Wired connection 1  378122bb-ad44-3ddd-a616-c93e1bf0f828  802-3-ethernet   enp59s0 
Xxxxxxxxx-5G        73c40a50-0f2e-431c-b12c-e4712b3abdb4  802-11-wireless  --      

---------------------------------------------------------------------------- */
END

EthernetInterface=$(ifconfig -a | grep ^'e' | cut -d' ' -f1)
Display "ifconfig -a | grep ^'e' | cut -d' ' -f1" \
"Ethernet Interface that could be used for WOL:   $EthernetInterface"
: <<'END'
/* ------------ RESULTS -------------------------------------------------------

Ethernet Interface that could be used for WOL:   enp59s0

---------------------------------------------------------------------------- */
END

# What WOL_Settings exist for Ethernet Interface?
WOL_Setting="'ethtool' not installed."
command -v ethtool >/dev/null 2>&1 && \
    WOL_Setting="$(ethtool $EthernetInterface | grep -i 'Wake-on:')"
Display "ethtool $EthernetInterface | grep -i 'Wake-on:'" "$WOL_Setting"
: <<'END'

/* ------------ RESULTS -------------------------------------------------------

Supports Wake-on: pumbag
Wake-on: g

---------------------------------------------------------------------------- */
END

Display 'END OF REPORT' ""

## TEST STUFF

#Spare:
: <<'END'
/* ------------ RESULTS -------------------------------------------------------
---------------------------------------------------------------------------- */
END

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .