I've been doing a little more hacking around to improve the SSH access, and a bit more flexible way to play with the scope. I did two things to make the SSH experience much snappier
- Disable DNS resolution in the /etc/sshd_config file to avoid waiting for DNS resolutions to time out
- Install a .ssh/authorized_keys file so that you don't need to enter root's password (Rigol201 these days) each time you log in. Or want to use scp to copy files out.
It involves just a few steps. First, once you've enabled the SSH server as described previously, you can SSH into the scope and modify the last line that was added to the
/rigol/shell/start.sh file on the scope to look like this instead:
/usr/sbin/sshd & [ -f /media/sda1/init/init.sh ] && sh /media/sda1/init/init.shThis just appends that latter conditional expression which checks for a file called
init.sh in the
init directory on the USB stick plugged into the scope. The embedded Linux in there has an old-school "ed" UNIX line editor that works just fine. Or you could just append that new bit to the file for the same effect from the shell with a command like
echo >> /rigol/shell/start.sh '[ -f /media/sda1/init/init.sh ] && sh /media/sda1/init/init.sh'Make sure you use two >> characters to
append and
not overwrite the file! Because of the risk of screwing up that file, it was better to change that start.sh file just once and experiment elsewhere with a separate script.
Now you need to create some files on the USB stick that you'll leave plugged into the scope. This is intended to be the same one that you might leave in there for saving screenshots or configurations. An
init directory is created on the USB stick. Then you then put a file in the
init directory called
init.sh, like the one that I've attached. (Note I had to attach a
.txt suffix to enable it to be attached to this post.) Also, you can put an
authorized_keys file next to the shell script in the same directory with your SSH public key(s) in there. If the authorized_keys file is missing, it just skips that step.
So now, each time your scope starts, it starts with checking to see if that init directory and init.sh script are present and then it will fix the SSH server's DNS lookup and install your authorized_keys file. It's necessary to do these fixes the scope boots as the root file system is RAM based and changes don't persist over reboots.
The other alternative I looked at was making an
init directory in the
/user directory on the scope. This is the "C" drive and where screenshots and save configurations land if you don't put them on a USB stick. I chose to do the USB stick instead, so if something went stupid, you could just unplug it when starting the scope and skip this. The script that I wrote looks for the various files in the same directory it was started from.
I'm sure this can be merged into a more general process like was used to install the sshd as an "upgrade" as described earlier in the thread. I thought it might be useful for others with some Linux experience to test-drive this before going that far.