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, 2015 at 16:07

1 Answer 1


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

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

You must log in to answer this question.

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