My VM created from contextualization Image (Centos 7)
I noticed that dropped my keys which was manually adding after first start my VM.
I think that scripts of contextualization run every time boot (after reboot) and recreated my authorized_keys file.
Is it normal action for contextualization and how it to avoid (Is it have way to disable automatically autostart vmcontext after first boot VM)?
As far as I know you either need to use contextualization or not. I don’t think you can mix and match. So you’ll need to add the keys via Sunstone, or disable Add SSH contextualization in the Context settings for that VM.
Someone can correct me if I’m wrong
you can add or edit existing scripts in /etc/one.context.d/ to achieve what you want
I want to execute the startup scripts to be executed only the first time VM boot. I dont want the init script to be executed everytime VM boot (reboot). How can I achieve this?
One of the possible way is to create some file at certain location during first boot and check its existence before execution of startup scripts.
I tried your suggestion. The files is getting created on boot. However for the second boot time, looks like the files is not present. It gets deleted upon boot. Is there any specific folder where the files will be persistent(permanent) across boot.
where you try to write? I think that for ex. /root/ will be fine
I tried creating a file in /root/, even after that its not working. This is my startup script in context:
if [ -f \"$FILE\" ];
echo \"File $FILE exist.\"
echo \"File $FILE does not exist\" >&2
sudo echo \"some file content\" > /root/x.txt
sudo apt-get install cmatrix
Is anything wrong with this script?
Hi. I have tried to create a file in /home/ directory. It works. Is this the right way?
there is no defined way, it’s up to you.
Thank you feldsam:slight_smile: