[dba-Tech] drive images and the Cloud

Jim Lawrence accessd at shaw.ca
Tue Jan 16 22:57:53 CST 2018


I recently discovered this solution. 

Given that it is not possible to run the "sudo" command remotely, because a password cannot be entered and then the command "dd", used to generate an image (ISO file), cannot be run. Below is a solution to the problem:

Quote:

The error you receive is due to the use of "sudo" command being used remotely (you would be asked for the password but you don't have a tty rights to enter it). On the other hand, as a normal user you can't normally use simply dd as suggested in another answer (you don't have the required permissions to the device). You can solve the problem by giving yourself rights to execute dd as sudo without a password. You can do this by editing the sudoers file (on the remote/Cloud instance!):

Run the following command line:
sudo visudo

Then add the following line to the text document (Be sure to substitute your username for "userfoo"):
userfoo ALL=(ALL) NOPASSWD: /bin/dd if=/dev/sdX

Then save and exit and you can now issue the following command line:
ssh userfoo at host "sudo /bin/dd if=/dev/sdX" | dd of=test.dd

...and it should work. You could make a more generic entry in sudoers, allowing you to run dd with any parameter, but it is wiser to keep this "free-permission" to the minimum you need.

Jim


More information about the dba-Tech mailing list