You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by MARCO ANTONIO RIVERA ORTEGA <mr...@usmp.pe> on 2024/10/28 21:39:17 UTC

Issue with Guacamole

Hello everyone, I have a question.
I have currently configured Guacamole to log in through Office 365. Every time someone enters the application, they do so and their new user is created, however I want to be able to upload a list of specific users.
Is there a way to add users in bulk? Perhaps through a .csv or .txt file and thus avoid the user having to log in to register for the first time in the application.
Is this possible?

Re: Issue with Guacamole

Posted by Der PCFreak <ma...@pcfreak.de>.
Hi,

> Is there a way to add users in bulk? Perhaps through a .csv or .txt 
> file and thus avoid the user having to log in to register for the 
> first time in the application.
> Is this possible?

You could use a bash script using curl to call the API for that:

Create a .CSV file in my case I used |demo.csv| where every line 
contains |username,organization,full name,timezone| e.g.:

|peter,Homeland Security,Peter Hacker,Europe/Berlin sepp,DOD,Sepp 
Intruder,America/Chicago jeff,FBI,Jeff Johnson,Australia/Adelaide |

then modify the following lines:

|adminuser='youradminuser' adminpass='youradminpassword' 
baseurl='https://<your guacamole url>' |

in the following script |demo.bash| within the same folder as |demo.csv|

|#!/bin/bash adminuser='youradminuser' adminpass='youradminpassword' 
baseurl='https://<your guacamole url>' csvfile='./demo.csv' # get auth 
token result=$(curl -s -d "username=$adminuser&password=$adminpass" -X 
POST "$baseurl/api/tokens") token=$(echo $result | jq -r .authToken) 
datasource=$(echo $result | jq -r .dataSource) echo "$token $datasource" 
while IFS=, read -r username organization fullname timezone do echo 
"$username $organization $fullname $timezone" # create new user 
result=$(curl -s -H 'Accept: application/json' -H 'Content-Type: 
application/json' -X POST 
"$baseurl/api/session/data/$datasource/users?token=$token" --data-binary 
@- << EOF { "username": "$username", "attributes": { "disabled": "", 
"expired": "", "access-window-start": "", "access-window-end": "", 
"valid-from": "", "valid-until": "", "timezone": "$timezone", 
"guac-full-name": "$fullname", "guac-organization": "$organization", 
"guac-organizational-role": "" } } EOF ) done < "$csvfile" |

Now running |./demo.bash| should create the 3 users *peter*, *sepp* and 
*jeff*.

Worked for me, maybe works for you, too.

Regards

Peter

&#8203;

Re: Issue with Guacamole

Posted by Nick Couchman <vn...@apache.org>.
On Mon, Oct 28, 2024 at 5:40 PM MARCO ANTONIO RIVERA ORTEGA <
mriverao@usmp.pe> wrote:

> Hello everyone, I have a question.
> I have currently configured Guacamole to log in through Office 365. Every
> time someone enters the application, they do so and their new user is
> created, however I want to be able to upload a list of specific users.
> Is there a way to add users in bulk? Perhaps through a .csv or .txt file
> and thus avoid the user having to log in to register for the first time in
> the application.
> Is this possible?
>

This feature will be present in version 1.6.0, when it is released:

https://issues.apache.org/jira/browse/GUACAMOLE-926

-Nick