How to assign a bash script for every user created with cubic and how to execute it automatically one time only
Hello to everyine,
I'm tryng to create a custom ubuntu installation with cubic where I would like that qemu,kvm and virt-manager with all the dependencies worked like a charm. To do that,I need that every user that is created as soon as Xubuntu will start working,will execute these commands only one time :
groupadd libvirt
sudo usermod -a -G libvirt `whoami`
sudo adduser `whoami` libvirt
otherwise it will not work. So,I'm trying to figure out how to do this. I've tought to add a script like this on the /etc/skel/autostart folder within the cubic environment :
[Desktop Entry]
Type=Application Version=1.0
Name=virt-
Comment=
Exec=/opt/
StartupNotify=false
Terminal=false
and on /opt,the script called prepare-
#!/bin/bash groupadd libvirt
sudo usermod -a -G libvirt `whoami`
sudo adduser `whoami` libvirt
making it executable :
chmod +x /opt/prepare-
Soon I've realized that my script would need to be run as root. Sticking it in skel would just put it in every new user's autostart folder but none of them would be root so the local autostart would fail.
So I tried to name my script adduser.local and I've sticked it in /usr/local/sbin, which is executed after adding a new user and is run by root. adduser.local is executed after adduser runs.
/usr/local/
#!/bin/bash usermod -a -G libvirt $1
Unfortunately when I have installed the cubic iso image,I've realized that it is not executed. How ? I have executed it again,but this time using the username of the user created,like this:
sudo usermod -a -G libvirt john
and after a reboot,virt-manager worked like a charm. So,I would like to know why the /usr/local/
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Cubic Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Marietto for more information if necessary.