cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Bookmark
|
Subscribe
|
414
Views
0
Helpful
0
Replies

VIRL sudo not working on LXC images

Aki at NTV
Level 1
Level 1

Hi guys, just wanted to share this as it seems really annoying when you fresh install VIRL and you cannot sudo/su from the LXC container images.. not the management lxc nor the various images available like iperf enabled one.

 

So login to your VIRL machine running the simulations with virl/VIRL and then "sudo su" and perform the following: 

 

(this will enable sudo from the mgt-lxc and any additional lxc machines so you can now sudo ifconfig, change interface ips/routes, etc)

 

1. Put this into "sudoers" file in your dir
cisco ALL=(ALL) ALL
guest ALL=(ALL) ALL

 

2. Run this to copy your sudoers file to all containers (user guest is for the mgt-lxc and cisco is for all the other lxc's)
for i in `ls -d /var/lib/lxc/*virl*`; do cat sudoers > $i/rootfs/etc/sudoers; done

 

3. Create pam.d in LXC containers
for i in `ls -d /var/lib/lxc/*virl*`; do mkdir $i/rootfs/etc/pam.d; done

 

4. Copy local pam.d to containers
for i in `ls -d /var/lib/lxc/*virl*`; do cp /etc/pam.d/* $i/rootfs/etc/pam.d/; done

 

You can of course fix this issue before booting the lxc images but not for the lxc-mgt server.. so I'm doing this everytime i boot a fresh simulation. If someone has a permanent fix for this issue i'd love to see it.

0 Replies 0