2

Status Quo :

On my WIN7 laptop, I have created a managed drive path from a USB stick (512MB, white Elago) that mounts to an empty NFS directory, say, C:\USB-KEY. In that path (could) exist a file, maybe, C:\USB-KEY\PRIVATE\RPI-B.ppk

The login/session profile via puTTY is given the path to the auth as described, i.e., C:\USB-KEY\PRIVATE\RPI-B.ppk, and thus RaspberryPi host (RPI-B) can be accessed only when USB stick (containing private key) is physcially inserted in that WIN7 laptop (or another similarly configured). RSA-2048 PairedKey-only access via puTTY. Password authentication = No. All well and good. No stick = No go. Golden.

i know there are lurking LOTS of (other) intricacies under the covers wrt SSH, keys, permissions, etc. some of those caused me early frustrations, but, eventually, this much works now! so ...

New Scenario :

Now, let's say I want to do a similar shuffle on the RPI-B host as well. No mount = no access, even if the pvtKey stick IS on the WIN7 laptop attempting access.

Intuition says a physical mount of ANOTHER stick (512MB, black Elago. yeah, I gots lots of 'em) on the RPI-B host needs additionally: 1) an fstab entry for device (perhaps with a non-default/special filesys) 2) a symbolic link to the mount as substitute for a current directory 3) an edit to refer to the mount/link rather than pubKey filref in /etc/sshd_config

QUESTIONS - A) can the reference to RPI-B pubKey file (/home/pi/.ssh/authorized_keys2) be a link to a mounted volume (black Elago) ? B) additionally, could a 'ping' succeed/fail based on that same volume (or, even another) being mounted ? i.e., ping response to determine possibility of login; response=mounted, ignore/timeout=no mount (RPI-B host is down?)

i can (wishfully?) see this working, but I also haven't successfully carried out the magic by myself. and, yes, if ANY piece isn't in place properly, it should fail!

could/would a craftier soul, please, assist in materializing this last bit?
or tell me it just can't be done? i could also envision (B) being useful with other than 'ping'; e.g., cron

thanks in advance

p.s. Raspberry Pi Model B+ v1.2 four USB ports (one occupied by Edimax EW-7811Un WiFi. yeah. power mgmnt OFF!) running newest 2016-05 Jessie distribution (with Kuman TFT 480x320 display local)


UPDATE
I will preface this with "IN A PERFECT WORLD ..."

ANSWER (A)
I made a backup and then added this line to /etc/fstab

UUID=F072-XXXX  /home/pi/theElago  vfat  auto,uid=1000,gid=1000,umask=0077,sync

ANSWER (B)
with (A) in place, from a script, one can use

if [ -f /home/pi/theElago/isMounted ]; then
#
#  action if the device is mounted
#
fi

But, I'm stuck on the "USB not available" flip-side scenario.
"Welcome to emergency mode."
i.e., the GUI does not load, and the boot process is held to a # root prompt ...

I need the not-available mount to fail, but the boot process to continue, which would ultimately make section B fail (appropriately). Sometimes, the stick/key may not be available (on purpose) and the system should behave accordingly, not hang. Placing mount code in user profile is not appropriate here. The "auto" is for mounting (or not?) at boot-time, yes?

Thanks in advance

ANSWER (C)
at least on 2016-05 Jessie, adding the nofail option seems to work.

UUID=F072-XXXX  /home/pi/theElago  vfat  auto,nofail,uid=1000,gid=1000,umask=0077,sync  

however, "nobootwait" does produce some unreliable results, sometimes running on without a mount actually having completed.

  • This creative question doesn't belong here. It is a programming issue and not Raspberry Pi specific. – fcm Jul 7 '16 at 1:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.