0

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/'"

1 Answer 1

1

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/"

1
  • i find another solution: vim /etc/sudoers # User privilege specification root ALL=(ALL) NOPASSWD: ALL when i use sudo mycommand it works without password but when i use ssh ..'sudo..' it doesnt work ! Have you an idea ? why it doesn't work with ssh ?
    – researcher
    Apr 29, 2015 at 14:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .