Menu

Bash script and Manage users

Help
Himeroos
2018-01-02
2018-01-02
  • Himeroos

    Himeroos - 2018-01-02

    Hello,

    I would like manage users phpvirtualbox with a bash script. Please, tell me if it's possible?

    Thank you, good day.

     
  • Thomas

    Thomas - 2018-01-02

    Hi,

    I suppose you have var $authLib = 'Builtin'; in your config.php.

    To add a user, you can use:

    username="thomas"
    password="password1234"
    isAdmin=0
    
    #Uncomment the following if you want the user to have admin rights
    #isAdmin=1
    
    vboxmanage setextradata global phpvb/users/${username}/admin ${isAdmin}
    vboxmanage setextradata global phpvb/users/${username}/pass $(echo -n ${password} | sha512sum | awk '{print $1}')
    

    To delete a user, you can use :

    username="thomas"
    
    vboxmanage setextradata global phpvb/users/${username}/admin
    vboxmanage setextradata global phpvb/users/${username}/pass
    

    Note that phpvirtualbox has several authentification modules available (see here). For example, the MySQL authlib could be more appropriate to manage user from command line or bash scripts.

     
  • Thomas

    Thomas - 2018-01-02

    I forgot to say that the vboxmanage command must be run as your virtualbox user, e.g. the user you have configured in config.php var $username = XXX;.

     
  • Himeroos

    Himeroos - 2018-01-02

    Hello, that's all I needed, really thank you it will be useful.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.