I'm setting up for a Proxmox 4 server a script that migrates OpenVZ dumps from a Proxmox 3.4. The scripts scp the backups, restores them and so on.

At a time of the process, I'd like to wipe /etc/network/interfaces and setup a new one using "pct set".

My problem is the following: to write default basic configuration into /etc/network/interface, I use lxt-attach. I mistakenly used this:

lxc-attach -n 101 -- echo "auto lo" > /etc/network/interfaces

You get it: I wiped my host's network config. So can someone tell me how to execute this command:

echo "auto lo" > /etc/network/interfaces

in a container using lxc-attach ?

Thanks a lot ;)

  • 3
    Try lxc-attach -n 101 -- bash -c 'echo "auto lo" > /etc/network/interfaces'. – jordanm Oct 31 '15 at 16:07

As @jordanm said (see comments), this one works:

lxc-attach -n 101 -- bash -c 'echo "auto lo" > /etc/network/interfaces'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.