CraigM
Posts: 6
Joined: Mon May 07, 2018 2:24 pm

SSH daily file creation...How do I do it?

Fri Apr 12, 2019 6:15 pm

Well I did it again...I ran "sudo apt-get update" again on a headless 3B+ ....Damn me! After 30 minutes of climbing in a wiring closet I removed and replaced the SD card adding the ssh file.

Once again I have ssh and vnc access to the Pi.

Yes, I understand the craving for security but the ssh file fiasco is just too much for me.

How do I run a daily routine to create the blank ssh file on the SD card so that when I mindlessly update the Pi It will still have ssh enabled?

Could I do it with a Cron job?

I'm a relative newbe so please be gentle...AND THANKS for your help!

Thanks, CraigM

DirkS
Posts: 9804
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: SSH daily file creation...How do I do it?

Fri Apr 12, 2019 6:24 pm

CraigM wrote:
Fri Apr 12, 2019 6:15 pm
Well I did it again...I ran "sudo apt-get update" again on a headless 3B+ ....Damn me! After 30 minutes of climbing in a wiring closet I removed and replaced the SD card adding the ssh file.
I have never had to re-enable ssh after an update...
If you're running one of the RPF Raspbian images there is something else going on; nothing to do with a ' craving for security' by the RPF/RPT.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5654
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: SSH daily file creation...How do I do it?

Fri Apr 12, 2019 6:27 pm

This is the second time I've seen somebody say that. Where is this information coming from? What gives people the impression that you ever need to enable ssh more than once?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5654
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: SSH daily file creation...How do I do it?

Fri Apr 12, 2019 6:29 pm

Oh... It's the same guy and this has already been explained to him before.

viewtopic.php?f=91&t=234025

B.Goode
Posts: 7685
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: SSH daily file creation...How do I do it?

Fri Apr 12, 2019 6:30 pm

Gently..

When you tried to discuss this a couple of months ago people - including RPF engineers - tried to point out that there must be some unusual root cause for your difficulties, because it is not the usual or expected behaviour of a Raspbian Stretch Operating System.

The SSH 'signal' file in the boot partition should enable the SSH Daemon permanently. And it should have no relevance to VNC.

I for one am curious to know what is overriding that expected behaviour.


But Yes, you could use a Cron job to touch /boot/ssh .

B.Goode
Posts: 7685
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: SSH daily file creation...How do I do it?

Fri Apr 12, 2019 9:10 pm

As suggested back in February - for troubleshooting/diagnostic purposes, could you experiment with a standard installation of Raspbian without the addition of the PiHole DNS service?

pcmanbob
Posts: 5881
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: SSH daily file creation...How do I do it?

Fri Apr 12, 2019 10:03 pm

I did suggest a possible cause on the other thread.

Updating pi-hole using sudo, which is not required.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
HawaiianPi
Posts: 3847
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SSH daily file creation...How do I do it?

Sat Apr 13, 2019 12:03 am

CraigM wrote:
Fri Apr 12, 2019 6:15 pm
Well I did it again...
Yup, YOU borked your system again. As was already discussed in your previous thread, it has absolutely nothing to do with Raspbian! I just updated my headless Pi systems (again), one of which runs Raspbian Stretch Desktop, and the others running Lite, and none of them lost SSH ability after rebooting (and the Desktop system still had VNC server running as well).

You need to stop blaming Raspbian and find out what YOU have done wrong. Something about your system configuration, or some software you are running is to blame. Are you using sudo when updating Pi-Hole as pcmanbob speculated?
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

pcmanbob
Posts: 5881
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: SSH daily file creation...How do I do it?

Sat Apr 13, 2019 11:20 am

I tend to do the updates on my pi 2B that's running pi-hole when ever there is a pi-hole update, I have done it both ways , updating pi-hole first with " pihole -up " and then doing " sudo apt-get update sudo apt-get dist-upgrade " and doing it the other way round updating the OS then pi-hole, never had any problems with SSH afterwards.

I am running raspbian stretch lite as the OS.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

CraigM
Posts: 6
Joined: Mon May 07, 2018 2:24 pm

Re: SSH daily file creation...How do I do it?

Sat Apr 13, 2019 6:51 pm

I just want to say Thanks,

First: I have never blamed Raspbian for the failures I am experiencing. I do not know enough about Raspbian to point any fingers. Yes, I admit I am doing something wrong....but I cannot figure out what I am doing wrong when I upgrade the 3B+.

For my piece of mind I would still like to run a Cron job nightly to create a blank ssh file in the boot directory.

That said...I started with a different SD Card and installed the Raspbian Stretch with desktop and recommended software using Etcher.

I created the ssh file with notepad and removed the file suffix ".txt" through Windows 7.

I booted the Pi 3B+ and all went well.

I used sudo raspi-config to enable VNC and rebooted.

The Pi came up in VNC normally and that's when things went bad. Yes, I took a screen shot but it is in the pdf format and cannot be uploaded.

Let me describe what I encountered: In the Raspberry Pi Configuration Menu, the screen only showed options down to the Resolution option.

I could not:
  • 1. Scroll down the page or
    2. Tab down the page to reveal the Cancel and Ok push buttons.
So I set the resolution to 1024 x 768.

Then I counted the number of tabs I had to enter until "System" was highlighted on the System Tab, five tabs. I then tabbed down to Resolution tab and entered four more tabs and pressed enter. It took a bit of trail and error to get this right not being able to see what was happening below the Resolution push button,

I rebooted and now the menus and options are all clearly visible and accessible.

Yesterday I spent the day running sudo raspi-config trying every possible resolution and configuration trying to change the VNC viewer I could find....All with no effect on the Raspbian desktop through the VNC viewer. That is why I elected to start all over with a new install.

I have now installed the Pi-Hole ad blocker and added the blocking files I use blocking, 3, 206,235 servers and all seems well. I installed the Pi-Hole with the curl -sSL https://install.pi-hole.net | bash command. Additional block lists come from: https://blocklist.site/app/

Everything appears to be working correctly on this install.

For my piece of mind I would still like to run a Cron job nightly to recreate the ssh file, if someone would be kind enough to guide me. Other than knowing what a cron job is I am truly clueless.

I have used the sudo apt-get install gnome-schedule command to install Cron. The "Scheduled Tasks" option now appears within the System Tools menu. Configure Scheduled Tasks opens correctly. I created a daily task to run in the early morning but cannot find any way to give it something to do. The only Python I know how to do involves shotguns and snakes in the Everglades.

Would a kind sole please help me create the cron job and Python necessary to create the completely unneeded ssh file just so I can sleep.

THANKS! CraigM

pcmanbob
Posts: 5881
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: SSH daily file creation...How do I do it?

Sat Apr 13, 2019 7:00 pm

I don't think adding an ssh file to the /boot directory on a nightly bases would do you any good as the pi would only look for the ssh file in the boot directory when it's booted from cold or a reboot.

Was there any reason you elected to install Raspbian Stretch with desktop and recommended software ?
if you are not going to use the pi for any other purpose then the Raspbian lite version would work just as well and take up less SD card space.

Cron is already installed and you can add cron lines direct from the command line using

Code: Select all

crontab -e
for the pi user or

Code: Select all

sudo crontab -e
for the root user I.E where your command requires the use of sudo at the command line.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

CraigM
Posts: 6
Joined: Mon May 07, 2018 2:24 pm

Re: SSH daily file creation...How do I do it?

Mon Apr 15, 2019 3:42 pm

Question: Was there any reason you elected to install Raspbian Stretch with desktop and recommended software ?

Answer: I installed the full set of software because there is plenty of room on the SD card. The extra software does not seem to slow down the DNS requests at all.

The most accurate answer might be that I do not know enough to not install the full package.

CraigM

User avatar
rpdom
Posts: 14074
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: SSH daily file creation...How do I do it?

Mon Apr 15, 2019 4:01 pm

CraigM wrote:
Mon Apr 15, 2019 3:42 pm
Answer: I installed the full set of software because there is plenty of room on the SD card. The extra software does not seem to slow down the DNS requests at all.
The unused extra software will not cause you any performance issues other then sometimes when running a software update. If, for example, the Wolfram Mathematica package has an update, you will find you have to wait ages (depending on your internet connection speed) to download the 300MB updated version of that package.
Signature is on holiday.

Return to “Advanced users”