VIRL sudo not working on LXC images
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2021 03:14 AM
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.
- Labels:
-
Cisco Modeling Labs
