避免 sudo 密码 /etc/apt/apt.conf.d/

避免 sudo 密码 /etc/apt/apt.conf.d/

我怎样才能避免在这个命令中使用“sudo”?

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

避免在(子)命令中使用 sudo 的唯一两种方法:

ssh -t ubuntu@$address -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/nul  -x 'sudo mv 00proxy /etc/apt/apt.conf.d/'

要么以 的身份登录rootubuntu要么(我真的不推荐这样做)/etc/apt/apt.conf.d/使用类似chmod a+w /etc/apt/apt.conf.d/

相关内容