pct exec with parameters

YAGA

Renowned Member
Feb 15, 2016
76
8
73
59
Hello,

I would like to execute a simple command to modify the timezone (with a redirection) inside a LXC container.

Code:
ssh root@192.168.1.2 pct exec 101 "-- echo Europe/Paris > /etc/timezone"

This command changes the timezone in the physical server (IP 192.168.1.2) and not inside the LXC container (ID 101).

Do you have a solution for this issue?

Regards,
YA
 
  • Like
Reactions: Zaman
Thanks for your answer, you probably meant lxc-attach instead pct-attach

I've found a solution for setting up a container from outside the physical machine.

Code:
ssh root@192.168.1.2 "pct exec 101-- bash -c 'echo "Europe/Paris" > /etc/timezone'"

Probably a simpler solution might exist.

Regards,
YA
 
Thanks for your answer, you probably meant lxc-attach instead pct-attach

I've found a solution for setting up a container from outside the physical machine.

Code:
ssh root@192.168.1.2 "pct exec 101-- bash -c 'echo "Europe/Paris" > /etc/timezone'"

Probably a simpler solution might exist.

Regards,
YA
Other simple solution:

Code:
ssh root@192.168.1.2 'echo "echo "Europe/Paris" > /etc/timezone" | pct enter 101'