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 aet@192.168.100.200 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 aet@192.168.100.200 is the IP of the tested device. It is connected by ethernet on a common switch with the testing one.

sshpass -p <password> ssh aet@192.168.100.200 StrictHostKeyChecking=no "echo gra64nola | sudo -S true mount /dev/sda1/ /media"

sshpass -p <password> ssh aet@192.168.100.200 StrictHostKeyChecking=no "echo gra64nola | sudo -S true umount /media"

sshpass -p <password> ssh aet@192.168.100.200 -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.

  • You may try ssh key authentication. – zombic Jun 08 '17 at 09:16
  • Sorry I'm new to ubuntu. I use this line a bit before to send audio files ssh-keygen -f /root/.ssh/known_hosts -R ${REMOTE_HOST} > /dev/null. Is that what you mean ? – Incarcerion Jun 08 '17 at 09:21
  • Remote host is just an inserted IP and I use a scp after this line – Incarcerion Jun 08 '17 at 09:22
  • $ ssh-keygen -t rsa -b 1024 -f ~/.ssh/id_rsa -> copy key to remote host $ ssh-copy-id -i ~/.ssh/id_rsa.pub aet@192.168.100.200 and then try connect without password $ ssh aet@192.168.100.200 – zombic Jun 08 '17 at 09:27

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