Programming a Pi to Deter Cats: Part 9.4

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am glad to say I have finally learned how to beat SSH keys into submission. Let’s get Started!

Computer security is important to get right. The moment you connect to the Internet, you potentially have a near infinite number of burgles trying to break into your device. That is why we have virus scanners and firewalls. SSH is an important and powerful tool for working with headless computers, but if mishandled, it can open a hole in your network security. That is why I always make sure I know what I’m doing and that someone else knows what I’m doing. Because if I don’t get things right, I may be looking at a dozen or so weeks learning about removing malware. If you are trying to learn any skills that can likely compromise your computer security, please seek supervision from someone who already knows how to do it safely.

I spent a lot of time in the workshop this week because I wanted to be sure I was being safe. Like my pile of sand a week or two ago, I had to learn a lot before the final pieces clicked.

SSH (Secure Shell) is a secure way of logging into another computer over a connection that can be assumed to have anyone may be listening in. When set up with SSH keys, a client program first asks the server for its host key. If the host key looks familiar, it’s probably the server the client thinks it’s connecting to. If not, the second layer of protection, host keys, let the client and host negotiate a way to scramble their conversation without eavesdroppers understanding.

Setting SSH up correctly is a bit more tricky to understand. I’ve heard there are lots of tutorials to disable the host key check because it’s annoying. Seat belts are annoying, but if they protect you even just once, they save you a lot of hurt in the long run. I don’t understand the differences between each host key, but from what I can tell, each computer, or at least each server, has one for each type of encryption. Blinky, my Raspberry Pi, came with at least six host keys.

Final Question: one of the challenges I had setting things up was being sure I was connecting to the server I was connecting to. Granted, it would have been safe in that instant to just click through. When was the last time you spent a lot of time figuring out why something works instead of just accepting it works for now and moving on?

Programming a Pi to Deter Cats: Part 8

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am droning on with my Raspberry Pi Cat Camera project.

Any sufficiently unguarded water cup is indistinguishable from a cat bowl. I had the unfortunate experience of going through that today. I gave it to the dogs. A completed sentry would not have helped in this case, but it serves as a little reminder. Of course, as soon as I get this thing working, I’d say its expected life expectancy is about a week or two. However long it takes before my cat stops the unwanted behavior.

I had a little bit of a tangent this week. It turns out it is very easy to get distracted when you have a special effects setup. The background I had last week, a constantly updating weighted average, was very entertaining in its own right. I could jump in front of the camera and fade in as if I were a ghost. I jump away, and my image fades out. If I held still, the picture would get sharper.

I ended up researching how to VNC into my Pi from my desktop so I don’t have to keep switching out the HDMI cord plugged into the back of my main monitor. It has actually been fairly uneventful so far. My password manager takes a while to register a new password, so I paused work on that angle of the project before I could set up a virtual desktop. The reason I want that is because the Pi checks if it is “headless” or without any video outputs when it boots. If there aren’t any, it goes into minimum resolution mode, presumably to conserve on CPU power. I have sense been careful to plug it in only after a monitor is connected.

I also went to the workshop again this week and promptly learned why I should always clean up after experiments; I had tried commenting out the line to convert to grayscale, and forgot to correct it. I also learned that the differing lighting conditions defeated the semi-fine tuned settings I had for my rudimentary motion spotter, and the ghost trails were back. We also did a big one on the old code while trying to simplify the code. One major change later, and I find things going half nuclear. I was given homework: Git Hub and code cleanup.

And by code cleanup, I mean extract the bits of code still in use after this great restructure and make it work again. I just need to be sure to chmod my new file. I’ll also be using native cv2 functions for finding the background and whatnot.

By next week, I hope to be able to remote into my Pi with full screen resolution, and get back to where I was but with native cv2 functions.

Final Question: How long will it take before the cat learns, and will I ever need to redeploy?

Operation: Remote Desktop

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am setting my main desktop up so I can use its full power from my laptop. Let’s get started!

While I have remoted into a computer before, this time, I have a deadline for personal reasons. I needed a stable setup that could withstand a reboot or update with minimal intervention. Since the target computer is running Windows 10 Pro, a built-in tool called Remote Desktop Connection looked like the best choice. Oh, I was in for an baaaaad time setting it up.

Things seemed like they were going almost too well at first. For one thing, it looked like the two computers had already played like this in their past, the laptop remembered the name and retained an old password for my specific tower. One problem: Where was the tower?

I must have spent the better part of a day churning over web pages looking for why my laptop couldn’t see my desktop. At one point, it I was convinced the only way to remote in was if you were already at the remote computer. It turns out, (And I’m not fully sure this is how it is, but I’m pretty sure.) the computers behind the router are seemingly not immediately part of a network. Either that or they were both treating it like a public network. My father and I worked on it for about half an hour, while I spent quite a bit of that time telling him what I tried and didn’t work.

We eventually got the two computers to see each other, but things were still not playing nicely together. We ended up checking out the firewall settings based on some of my research earlier in the day. We started flipping switches in Norton’s firewall settings until something worked. After that, we reactivated as much as possible, narrowing it down to the “Norton Smart Firewall” and I even got into some more finely tuned settings to where the smart firewall would let in remote control and, but leave on everything else. Settings (Upper right) > Firewall > General Settings > Smart Firewall > Public Network Exceptions. I enabled “Network Discovery” and “Remote Desktop Connection.”

Sure, at one point, my father had done something to where my laptop could try signing in, and we went down the wrong solution path and I ended up making a new account for my laptop. I was instantly reminded of how much I don’t like how Windows these days is built around the idea that all or most of its users are mostly computer illiterate touch screen users. I know I’m interested in social robotics, but it’s a little uncanny when it comes from an operating system I’ve grown up with.

Things became a lot easier after I managed to get a successful connection, but they weren’t perfect. First of all, my desktop immediately logged out. I was expecting something more along the lines of mirroring screens, but I can live with it this way. Secondly, I wanted to test a restart. The start menu only has a disconnect button now. I had to go back over to the tower and restart it myself. I use a lefty mouse, and both computers knew that. the result, both my computers flipped my mouse buttons, canceling each other out. I’ve unswapped the buttons on my tower.

After some basics were sorted out, I moved my monitors away from my desk and to my temporary setup, where I have my laptop and a more powerful WiFi antenna. I spent a while trying to set both my monitors up and use my laptop as a 3rd monitor, but it doesn’t look like it’s happy with that arrangement. I set my bit monitor to my primary display, and when I say to extend my desktop to my other monitor, it deactivates the laptop screen.

I still need a reinforced mouse pad, but I’m otherwise all set up. Sure, I elevated my laptop body so the screen would line up with the desktop monitors (The whole reason behind the desk is because of the whole battery drama I’ve written about in previous posts), and I would still like to get it working exactly how I want, but that doesn’t seem to be available right now

Final Question: When was the last time you used a driver CD?

Review and planning session

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am laying out my plans for the near future. Let’s get started!

I’m still figuring out the new setup with Derpy. The VNC client I set up on my main desktop isn’t sending keyboard shortcuts when remoting into Derpy, but my laptop does and I cannot find the setting to change it. It also seemed to prefer opening up programs for a local login (if present) if the remote server requested anything be open. I upgraded it to Ubuntu 18.04.1 LTS after trying to get some tech support over Discord.

In my last post, I believe I said I was now using GNOME 3. That was wrong. I’m on the Xfce desktop environment and I couldn’t tell the difference, especially while trying to elicit help. I’m willing to work with this desktop environment, as I hear it is supposed to be pretty stable, and it’s the only one I have to work with at the moment. Yes, I don’t have a way to switch desktop environments remotely. I tried logging out remotely, and the VNC session became unusable with that complex black and white “gray” pattern, replacing the desktop picture as I dragged lingering windows around. A reboot fixed the symptoms, but I still want to see about getting the root cause addressed sometime.

I have a few things I want to finish before going on with programming the Pi to detect and deter cats. Mostly the more intermediate Linux literacy skills, like getting WINE to run things reliably, or forcing a piece of hardware to work when it shouldn’t.

During my miscellaneous research this week, I found Rasbian is only a 32 bit operating system and the Raspberry Pi 3 family is all 64 bit based. I would like to explore benefits and drawbacks to finding a lightweight version of Linux to run on the Pi and running that for my cat program instead of just programming it for the board’s default OS.

Final Question: It’s hard to know what version of an otherwise identical product to go with, especially if you’ve never needed it before, especially software. I find a good word from someone I know goes a long way. How do you decide what version to use?


Remote Access 1

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I have a lot of progress to report on remote accessing my computers from each other. Let’s get started!

I spent most of my time for the blog this week in that workshop I joined a few months ago. A lot happened, but I am not the main mind who put everything together, and I don’t fully understand everything that’s going on.

This week, I gained the ability to log into Derpy, my secondary Minecraft server/Linux testing platform, from another computer using TightVNC (Virtual Network Computer). TightVNC is one of many desktop viewing applications; most others cost while I’m working with a free version.

The first step was to set up a server on Derpy and get another computer to try and connect. We eventually ended up with a “gray” error screen with a black x pointer if we had everything working as best as was possible (it was actually a complex pattern of black and white pixels).

Part of the wonkeyness of remoting in involves screen parameters, like size and this one I know nothing much about called color depth. Something along the way likes a color depth of 24.

While we tried a few possible fixes, multiple places said to put GNOME on for the graphical interface. While I find the Cinnamon nice and convenient, I am more than willing to explore something new to find something that works… GNOME surprised me with that pesky zoom in thing I abandon Unity over.

I did a bit of research, and the popular Unity environment is built on GNOME. I hypothesized that Unity had changed something Cinnamon couldn’t care less about. None of the normal zoom in fixes worked, and the text had their smooth, vector based look, even though they were huge, so we knew the picture was at the correct resolution.

Over an hour of pointless guesswork later, I had outsourced the problem to a Linux support Discord server. After no response and someone else’s problem getting solved, I reuploaded along with a photo of the screen this time. Over the next three minutes or so, a couple users by the names of MotherM and ~> yay -s Superuser went back and forth trying to figure it out until a user by the name of PlasmaPower offered a command to restore the correct interface scale factor to 1 where Superuser had identified it as at a factor of 2.

gsettings set org.gnome.desktop.interface scaling-factor 1

With GNOME functioning properly, I was able to make a connection and even managed to open the Minecraft server remotely. However, any new graphical programs, including terminals, opened up in the host machine. It turns out, using TightVNC server hosts an extra login session, at least the way it was set up. Before I left the workshop, we got a script set up to automatically start the VNC server whenever the computer restarts.

Later, I figured out that if I logged out from the host machine, newly opened programs work as expected. I also eliminated one of my dual hypotheses. New programs prefer to open locally before yielding to remote sessions when dealing with multiple logins from the same username, not the first session started.

As it stands, the connection is stable. Future improvements may include sizing the resolution to fit my secondary monitor and getting a version of GNOME installed I can relate to a little better. I should also be able to set it up for CLI mode only for the host terminal.

Final Question: Linux is apparently the hardest OS to get set up for remoting into. When was the last time you reached the finish line, only to find out you were doing it the hard way, even if the easy way wouldn’t have worked for you anyway?