Snippets

Peter Scargill "The Script"

Updated by Peter Scargill

File script.sh Modified

  • Ignore whitespace
  • Hide word diff
 ##
-##  "The Script" version May 07, 2020 updates reference to http://tech.scargill.net to the https version
-##  and fix basic web page, remove darksky node 
+##  "The Script" version May 07, 2020 updates reference to http://tech.scargill.net to the https version, 
+##  improves remote root access and fixes/improves basic web page, removes DarkSky node 
 ##  December 19 2019 fixed a connection check
 ##  Previous updates includes changes to handle Raspbian Buster, RPi4 and other recent changes
 ##  including the latest Node/Node-Red updates (at this time v1.0.2) on Raspbian 
 	sudo sed -i -e 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
 	sudo sed -i -e 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
 	sudo sed -i -e 's/PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
+	sudo sed -i -e 's/#PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
+	sudo sed -i -e 's/#PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
+	sudo sed -i -e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
 	sudo sed -i -e 's/TCPKeepAlive yes/TCPKeepAlive no/g' /etc/ssh/sshd_config
 	sudo sed -i '$ a UseDNS no' /etc/ssh/sshd_config
 	sudo sed -i '$ a ClientAliveInterval 30' /etc/ssh/sshd_config
         "rpiclone" "Install RPI-Clone" ON \
         "log2ram" "Install Log2RAM default 40 Meg" OFF \
 		"grafana" "Install Grafana and InfluxDB" OFF \
-		"rootaccess" "Enable remote root access" OFF \ 
  		"wolfram" "Remove Wolfram on a PI to save space" OFF \
         "office" "Remove LibreOffice on PI to save space" OFF 3>&1 1>&2 2>&3)
 else
 sudo grep -h ^deb /etc/apt/sources.list /etc/apt/sources.list.d/* 2>&1 >> $LOGFILE
 echo "alias space='df -h|grep -v udev|grep -v tmpfs|grep -v run'" | sudo tee -a /etc/bash.bashrc > /dev/null 2>&1
 
-if [[ $MYMENU == *"rootaccess"* ]]; then
-	sudo sh -c "echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
-fi
 
 printstatus  "ALL DONE - PLEASE REBOOT NOW THEN TEST"
Updated by Peter Scargill

File script.sh Modified

  • Ignore whitespace
  • Hide word diff
 ## We cannot answer questions on board/operating system combinations we have not tested. See notes below for tested combos.
 ## 
 ## 25/10/2019 I installed all defaults in the script and in addition non-default Grafana onto an ACEPC T9 on which I'd installed the latest Debian Buster
-##            Note that Bustr on a non-Pi machine may not have SUDO installed by default. To become a super-user to install it if you can't get to root, "su -".
-## July 2019 used 3-liner as in the blog to upgrade an RPI which had been set up initially using the script in Stretch - to Buster.
+##            Note that Buster on a non-Pi machine may not have SUDO installed by default. To become a super-user to install it if you can't get to root, "su -".
+## 01/07/2019 used 3-liner as in the blog to upgrade an RPI which had been set up initially using the script in Stretch - to Buster.
 ## 17/02/2019 Added pure-ftp
 ## 07/02/2019 Separated NR into official NR install script, added tcpdump - not added fing but worth doing?
 ## 17/02/2019 I added nmap, netdiscover and also node-red-contrib-advanced-ping
 ## 26/12/2016 - complete re-hash for new menus
 ## 02/12/2016 Tested Roseapple Pi using Armbian - for Node-Red serial, had to
 ## 			  enable permissions for the serial - everything worked first time
-## 16/5/2016  Tested on NanoPi M1 - (got 3 UARTS out of the M1)
+## 16/05/2016  Tested on NanoPi M1 - (got 3 UARTS out of the M1)
 
 ## 22/06/2016 tested on NanoPi NEO using Armbian Jessie Server
 ## 28/12/2016 tested in DietPi and Xenial virtual machines
 ## you could run the file as ./script.sh
 ##
 ##
-## Note- on the Odroid C2 everything installed except webmin. After reboot this is what I did to get it running..
+## Note- on the Odroid C2, everything installed except Webmin. After reboot this is what I did to get it running..
 ##    wget http://prdownloads.sourceforge.net/webadmin/webmin_1.850_all.deb
 ##    sudo dpkg --install webmin_1.850_all.deb
 ##    That complained about missing bits so I used...
         "rpiclone" "Install RPI-Clone" ON \
         "log2ram" "Install Log2RAM default 40 Meg" OFF \
 		"grafana" "Install Grafana and InfluxDB" OFF \
-        "wolfram" "Remove Wolfram on a PI to save space" OFF \
+		"rootaccess" "Enable remote root access" OFF \ 
+ 		"wolfram" "Remove Wolfram on a PI to save space" OFF \
         "office" "Remove LibreOffice on PI to save space" OFF 3>&1 1>&2 2>&3)
 else
     MYMENU=$(whiptail --title "Main Non-Pi Selection" --checklist \
 
 if [[ $MYMENU == *"nodejs"* ]]; then
     printstatus "Installing NodeJS"
-	LATESTNODE="v6.17.1"
+	LATESTNODE="v12.16.3"
     if [[ $(uname -m) == *"armv6"* ]]; then
         printstatus "Installing ARM6 version"
         wget --no-check-certificate https://nodejs.org/dist/$LATESTNODE/node-$LATESTNODE-linux-armv6l.tar.xz -a $LOGFILE
 echo -e MQTT: $(/usr/sbin/mosquitto --help | grep version) >> $LOGFILE
 sudo grep -h ^deb /etc/apt/sources.list /etc/apt/sources.list.d/* 2>&1 >> $LOGFILE
 echo "alias space='df -h|grep -v udev|grep -v tmpfs|grep -v run'" | sudo tee -a /etc/bash.bashrc > /dev/null 2>&1
+
+if [[ $MYMENU == *"rootaccess"* ]]; then
+	sudo sh -c "echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
+fi
+
 printstatus  "ALL DONE - PLEASE REBOOT NOW THEN TEST"
Updated by Peter Scargill

File script.sh Modified

  • Ignore whitespace
  • Hide word diff
 ##
-##  This version May 07, 2020 updates reference to http://tech.scargill.net to the https version.
-##  Version of "The Script" December 19 2019 fixes a connection check
+##  "The Script" version May 07, 2020 updates reference to http://tech.scargill.net to the https version
+##  and fix basic web page, remove darksky node 
+##  December 19 2019 fixed a connection check
 ##  Previous updates includes changes to handle Raspbian Buster, RPi4 and other recent changes
 ##  including the latest Node/Node-Red updates (at this time v1.0.2) on Raspbian 
 ##  and to use official NR install script on RPi - also fixes to accomodate changed Grafana Repository. 
 	node-red-contrib-web-worldmap node-red-contrib-ramp-thermostat node-red-contrib-fs-ops node-red-contrib-influxdb \
 	node-red-contrib-isonline node-red-node-ping node-red-node-random node-red-node-smooth node-red-contrib-npm node-red-node-arduino \
 	node-red-contrib-file-function node-red-contrib-boolean-logic node-red-contrib-blynk-ws node-red-contrib-telegrambot node-red-contrib-dsm node-red-contrib-ftp \
-	node-red-dashboard node-red-node-darksky node-red-contrib-owntracks node-red-contrib-alexa-local node-red-contrib-amazon-echo node-red-contrib-alexa-notifyme node-red-contrib-heater-controller ; do
+	node-red-dashboard node-red-contrib-owntracks node-red-contrib-alexa-local node-red-contrib-amazon-echo node-red-contrib-alexa-notifyme node-red-contrib-heater-controller ; do
 		printstatus "Installing node \"${addonnodes}\""
 		npm $NQUIET install --save ${addonnodes} 2>&1 | tee -a $LOGFILE
 	done
 	node-red-contrib-web-worldmap node-red-contrib-ramp-thermostat node-red-contrib-fs-ops node-red-contrib-influxdb \
 	node-red-contrib-isonline node-red-node-ping node-red-node-random node-red-node-smooth node-red-contrib-npm node-red-node-arduino \
 	node-red-contrib-file-function node-red-contrib-boolean-logic node-red-contrib-blynk-ws node-red-contrib-telegrambot node-red-contrib-dsm node-red-contrib-ftp \
-	node-red-dashboard node-red-node-darksky node-red-contrib-owntracks node-red-contrib-alexa-local node-red-contrib-amazon-echo node-red-contrib-alexa-notifyme node-red-contrib-heater-controller ; do
+	node-red-dashboard node-red-contrib-owntracks node-red-contrib-alexa-local node-red-contrib-amazon-echo node-red-contrib-alexa-notifyme node-red-contrib-heater-controller ; do
 		printstatus "Installing node \"${addonnodes}\""
 		npm $NQUIET install --save ${addonnodes} 2>&1 | tee -a $LOGFILE
 	done
Updated by Peter Scargill

File script.sh Modified

  • Ignore whitespace
  • Hide word diff
 ##
-##  This version May 2020 updates reference to http://tech.scargill.net to the https version.
+##  This version May 07, 2020 updates reference to http://tech.scargill.net to the https version.
 ##  Version of "The Script" December 19 2019 fixes a connection check
 ##  Previous updates includes changes to handle Raspbian Buster, RPi4 and other recent changes
 ##  including the latest Node/Node-Red updates (at this time v1.0.2) on Raspbian 
 if [[ $MYMENU == *"addindex"* ]]; then
     printstatus "Adding index page and CSS"
     if [ -d /var/www/html ]; then
- 		sudo wget -a $LOGFILE $AQUIET http://www.scargill.net/iot/index.html -O /var/www/html/index.html
-		sudo wget -a $LOGFILE $AQUIET http://www.scargill.net/iot/reset.css -O /var/www/html/reset.css
+ 		sudo wget -a $LOGFILE $AQUIET https://www.scargill.net/iot/index.html -O /var/www/html/index.html
+		sudo wget -a $LOGFILE $AQUIET https://www.scargill.net/iot/reset.css -O /var/www/html/reset.css
     else
         printl "${IRed}!!!! Apache+PHP not installed! ${IWhite}\r\n"
     fi
Updated by Peter Scargill

File script.sh Modified

  • Ignore whitespace
  • Hide word diff
 ##
-##  This version of "The Script" December 19 2019 fixes a connection check
+##  This version May 2020 updates reference to http://tech.scargill.net to the https version.
+##  Version of "The Script" December 19 2019 fixes a connection check
 ##  Previous updates includes changes to handle Raspbian Buster, RPi4 and other recent changes
 ##  including the latest Node/Node-Red updates (at this time v1.0.2) on Raspbian 
 ##  and to use official NR install script on RPi - also fixes to accomodate changed Grafana Repository. 
             
 	cd ~/.node-red/
     npm $NQUIET audit fix
-	sudo wget -a $LOGFILE $AQUIET http://tech.scargill.net/iot/settings.txt -O settings.js
+	sudo wget -a $LOGFILE $AQUIET https://tech.scargill.net/iot/settings.txt -O settings.js
 
 	echo " "
 	bcryptadminpass=$(node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" $adminpass)
 	fi
             
             cd ~/.node-red/
-	 		sudo wget -a $LOGFILE $AQUIET http://tech.scargill.net/iot/settings.txt -O settings.js
+	 		sudo wget -a $LOGFILE $AQUIET https://tech.scargill.net/iot/settings.txt -O settings.js
 
             #sudo service nodered start 2>&1 | tee -a $LOGFILE
 			#while [ ! -f settings.js ] ; do sudo sleep 1 ; done
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.