Reputation: 919
I want to write a .img file to a hdd over ssh.
Host A want to execute dd to write the img file to /dev/sda . The dd file is located at Host B.
How should the command look like?
Upvotes: 1
Views: 1598
Reputation: 9416
Something like:
(from hosta) ssh hostb cat /the/file.img | dd of=/dev/sda
or
(from hostb) ssh hosta dd of=/dev/sda < /the/file.img
With ssh (and rsh before it) the I/O redirection happens on the local host unless you quote it to pass it through to the remote host. Compare these three commands (in all cases the date
command runs on rmthost
), but:
ssh rmthost date > /tmp/thedate ! local file written
ssh rmthost 'date > /tmp/thedate' ! remote file written
ssh rmthost date '>' /tmp/thedate ! remote file written
Upvotes: 2