I have inherited a Ubuntu 14.04 production server which needs to be upgraded to 20.04, and I would like a sandboxed version to experiment with first, hence I want to dump
and restore
the filesystems over the network from either a MacOS or another 14.04 virtualbox instance. An earlier version of this question is at https://askubuntu.com/q/1314747/963.
The server cannot "see" my machines so I cannot easily run dump and push the result remotely to my machine, but need to invoke ssh from my machine to run dump.
ssh -t me@there "echo MYPASSWORD | sudo -S dump -y -f - /boot 2>/dev/null " > boot.dump
Problem is that I've found that running this command inserts a lot of \r
characters in front of \n
characters which ruins the dump file so restore
cannot use it. I understand that this is probably due to a driver translating linefeeds to the characters needed for printing, but I do not see where this is triggered.
How should I do this to get the correct binary dump file?
-t
fromssh
. – Feb 09 '21 at 16:09sudo
, so you probably are), it might be easier to configure sudo with!requiretty
andNOPASSWD
? – Ulrich Schwarz Feb 09 '21 at 19:13sudo
on the other machine ( which exposed your password to other users on the machine who can runps
), you might have an easier time adding your ssh key to /root/.ssh/authorized_keys on the remote machine and sshing in directly as root. – psusi Feb 09 '21 at 19:29