Support Questions

Find answers, ask questions, and share your expertise

How to configure Ranger Usersync to sync users from a file

avatar
 
1 ACCEPTED SOLUTION

avatar
Super Collaborator
4 REPLIES 4

avatar

Set the following properties in usersync :

usergroupSync.source.impl.class = org.apache.ranger.unixusersync.process.FileSourceUserGroupBuilder

usergroupSync.filesource.file =C:\\tmp\userSource1.json

usergroupSync.filesource.text.delimiter = , Example file: Multiple Users

{

"user1001": [

"group0",

"group18",

"group6",

"group7",

"group26",

"group24",

"group19",

"group3",

"group5"

],

"user2001": [

"group0",

"group18",

"group6"

]

}

avatar

Another approach:

Create a text file containing user/group details in the following format:

        - one line for each user

        - each line consists of multiple fields, separated by a comma

        - the first field is the username and every field after that is a group name the user belongs to

        - example line: user1,group1, group2,group3

  Load the user/group information in the text file, say at /home/user/ranger-users.txt, with the following command line:

  java -cp "/usr/hdp/current/ranger-usersync/dist/unixusersync-0.4.0.2.2.0.14-2.jar:/usr/hdp/current/ranger-usersync/lib/*:/etc/ranger/usersync/conf" com.xasecure.unixusersync.process.FileSourceUserGroupBuilder /home/user/ranger-users.txt
Updated for Ranger 0.50
java -Dlogdir=/var/log/ranger/usersync -cp "/usr/hdp/current/ranger-usersync/dist/*:/usr/hdp/current/ranger-usersync/lib/*:/usr/hdp/current/ranger-usersync/conf" org.apache.ranger.unixusersync.process.FileSourceUserGroupBuilder /tmp/UserGroupSyncFile.txt

avatar
Super Collaborator

avatar

Thanks for creating the wiki for this