start an app at boot as given user

Hello :slight_smile:

I need to start VirtualBox on my server at boot time as “virtual” user, not root.

  • What is the command line to do so? Virtual box command is “VBoxManage startvm xxx” but for “virtual” user?

  • I think of setting this line in /etc/init.d/boot.local, but I wonder if this is not too early in the boot process?

of course I need all this to be done on non-interactive way, automatically (from the command line, I do it easily), including passwds

thanks

I think you will need to log the user in with a sudo command to start the program under the target user credentials. You need to set this up in the sudo configuration files or Yast.

I have had the answer elsewhere, it’s su (I did look at sudo with no luck):

su virtual -c "VBoxManage startvm s-r"

however, I still wonder if this will start in boot.local. Copy of this file:

# Here you should add things, that should happen directly after booting
# before we're going to the first run level.

I remember long time agos having to write my own “boot.final”, that is a script run at the end of the boot process (specially after any network config)

thanks

Hi! According to /etc/init.d/rc there should be file after.local. If it doesn’t exit - just create it.

don’t exist, easy to create :slight_smile:
thanks
jdd