Support script

I am toying with the idea of being brave enough to install Linux on a person’s new machine instead of loading them with Windows (which is all they’re ever seen). Due to the fact they are 2.5 hours drive each way from me, I don’t see driving over and helping them as an option.
So…I was wondering if anyone has a similar circumstance and has engineer’d a script that would do things like fire up SSHD, allow incoming connections, and mail me their IP address, so that I could SSH in, when they get in the weeds?
That would typically (imo) be a better option that a remote desktop software of some sort, but maybe that would be an option too?

I’m just trying to ready myself in case they do want to go that way, so that it might not be a bad experience for them. I’m also trying to figure out what distro I think they should run (and no sorry, I don’t believe an Arch based one is a good fit for someone that isn’t technical and doesn’t want to be). You know I love Arch, but I only love if for those that want to learn how to deal with it.

I agree. Mint and Zorin are the usually recommended ones I see around the net. Getting ssh ready should be as simple as installing it. I think it even enables it for you. As for the script to get and send their IP address, that’s a bit above my level with bash. It might be possible with python though.

Getting the external IP with python:

import urllib.request

external_ip = urllib.request.urlopen('https://ident.me').read().decode('utf8')

print(external_ip)

The following is a script I wrote to track the ISS and email me whenever it’s overhead. It should be adaptable to send the IP address. They would need the ssh port (usually 22) to be open and forwarded on their router.

import requests
from datetime import datetime, timedelta
import smtplib
import time


def iss_close(iss_lat, iss_long):
    return MY_LAT - 5 < iss_lat < MY_LAT + 5 and MY_LONG - 5 < iss_long < MY_LONG + 5


MY_LAT = 150.972679
MY_LONG = 20.964200

FROM_ADDRESS = "FROM EMAIL HERE"
FROM_PASSWORD = "FROM PASSWORD HERE"
TO_ADDRESS = "TO EMAIL HERE"
SMTP_SERVER = "MAIL SERVER HERE"

last_sent = datetime.now() - timedelta(hours=-2)

while True:
    time.sleep(60)

    if datetime.now() < last_sent + timedelta(hours=1):
        continue

    response = requests.get(url="http://api.open-notify.org/iss-now.json")
    response.raise_for_status()
    data = response.json()

    iss_latitude = float(data["iss_position"]["latitude"])
    iss_longitude = float(data["iss_position"]["longitude"])

    if iss_close(iss_latitude, iss_longitude):
        message = f"Subject:The ISS is close by\n\nAt coordinates lat: {iss_latitude}, lng: {iss_longitude}. You should " \
                  f"go and gawk! "

        with smtplib.SMTP(SMTP_SERVER) as connection:
            connection.starttls()
            connection.login(user=FROM_ADDRESS, password=FROM_PASSWORD)
            connection.sendmail(from_addr=FROM_ADDRESS, to_addrs=TO_ADDRESS, msg=message)

        last_sent = datetime.now()

If I were to do this, I would go for Debian (with a no frill DE), or perhaps a Debian-based like LMDE.

I agree fully.

For the rest, sorry, I cannot be of any help.

Yes, I’m fully capable of writing such a script, but I was just hoping someone else has already done so (and debugged possible issues, which always pop up) :slight_smile:

If they have an issue with the Internet connection, ssh’ing into their system won’t really work. About the same if they have a GUI issue (e.g. the window manager hanging); a non-technical person won’t be able even to run that script.

And have their system hacked in a matter of minutes. Forwarding the port should be a part of the script IMO.

Yes, there are issues, but I don’t know a better solution unless I wanted to move back there lol.

Might it be an idea to have a VPN running on their system? Perhaps combine that with a DDNS service?

I have a server at home where I’ve installed wireguard with pivpn, and whenever I’m away from home I can connect with my phone or laptop to the server and setup an SSH session. Works as long as there is an internet connection.

Just my 2 cents.

Hmm, yes, I haven’t monkey’d with DDNS in ages, but I could probably figure it out again lol before any hardware might arrive.

I myself am not using a ddns anymore. I have a domain name, which is tied to our home IP- address. Though our ISP says that we have a dynamic address, the fact is that the address hardly ever changes. Happened once or twice in quite a lot of years.

Many moons ago, when I still had all my hair, I used:

Not an endorsement, just a starting point for your quest for a DDNS.

Agree.

I’ve recently installed Debian with KDE/Plasma for someone. They were pleasantly surprised. I think it made them think of Windows 7.

I was favoring an atomic distro for safe upgrades, but there are some other issues there…may drop the notion.
I’m also tending toward Cosmic DE as something that supports a mode they’re familiar with (floating windows) but also the option to tile if they can wrap their heads around it. I dunno if he can or not..but…options are sometimes good.

I would setup dynamic dns using one of the many free services out there then there IP address would always be available to you. Allow SSH through the network and local firewalls permanently.

Then all they need to do is start sshd.

I have had the best luck with Mint and PopOS for that use case.

Certainly an atomic distro has advantages for such use cases. I tend to avoid them because I always something that is easy for me to support remotely. Making changes to some of those atomic distros is often complicated and sometimes involves multiple reboots.

Can I recommend rustdesk? I remote into a few PCs, e.g.

I will certainly look into it (security/reliability,etc)

OK, here is another idea - waypipe:

waypipe ssh -p <port> user@server program-name

The above worked for konsole & dolphin, failed on kitty with an egl error.

Pretty neat, like the old Xwindows setenv DISPLAY user@host CMD