6

I'm currently working on two devices, one testing the other. They are based on beaglebone black, and run under Ubuntu 14.04. My problem is I have to detect and mount a USB external storage on the tested device but from the tester device.

I tried a few commands to avoid entering passwords like

sshpass -p <password> ssh [email protected] StrictHostKeyChecking=no "echo gra64nola | sudo -S true mount /dev/sda1/ /media"

but when I execute this line, nothing happens on the remote device. I tried a few different versions on this command line, but I'm lost now. I got no idea how to do what I want.

For information I work under node-red and I execute these three command lines to detect and mount the device. The [email protected] is the IP of the tested device. It is connected by ethernet on a common switch with the testing one.

sshpass -p <password> ssh [email protected] StrictHostKeyChecking=no "echo gra64nola | sudo -S true mount /dev/sda1/ /media"

sshpass -p <password> ssh [email protected] StrictHostKeyChecking=no "echo gra64nola | sudo -S true umount /media"

sshpass -p <password> ssh [email protected] -o StrictHostKeyChecking=no "echo gra64nola |sudo -S find /media/FINDME.txt"

the third one is used to find a file to check if USB port of device works. I don't want anybody to do my whole job, but would you please know how to mount this external disk please ?

Thanks for any help.

1 Answers1

5
sudo -S true mount /dev/sda1/ /media

true usually ignores any arguments passed to it, so the mount ... part is completely ignored. If you want to run the mount command, don't use true. Just do:

sudo -S mount /dev/sda1/ /media

Also look into:

muru
  • 197,895
  • 55
  • 485
  • 740