How can I avoid 'sudo' in this command?
ssh -t root@$machine -x "sshpass -p 'ubuntu' ssh -t ubuntu@$address -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/nul -x 'sudo mv 00proxy /etc/apt/apt.conf.d/'"
The only two ways to avoid sudo in the (sub)-command:
ssh -t ubuntu@$address -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/nul -x 'sudo mv 00proxy /etc/apt/apt.conf.d/'
Would be to either log in as root
instead of ubuntu
, or (I really don't recommend this) change the permissions on /etc/apt/apt.conf.d/
with something like chmod a+w /etc/apt/apt.conf.d/
"