Support Questions
Find answers, ask questions, and share your expertise

Create Users Linux Script - How restrict access users create from ambari view (file view) to upload and remove file for another users

Explorer

Hi

i have a Question and put my script to help somebody maybe need

This script create a User and Folder on all host defined on cluster, assign privilegies and add to group hdfs. Then i create the same created User in ambari view (File View) to upload files into a respective folder after created with the script But all Users created in ambari view can upload to another User folders and delete files i have ranger installed but i can`t find where i can control the control option to dont write or delete in not own directory.

SCRIPT

" echo "

" echo "" echo -n "Ingrese por favor el nombre del usuario a crear: " $username read username echo -n "Creando usuario en Servidor Maestro: " useradd -G hdfs $username passwd $username echo -n "Usuario $username creado OK en Servidor Maestro: " echo "" echo -n "Creando usuario en Host1: " ssh root@192.168.XX.XX useradd -G hdfs $username echo "" ssh root@192.168.XX.XX passwd $username echo "" echo -n "Usuario $username creado OK en Host1: " echo "" echo -n "Creando usuario en Host2: " ssh root@192.168.XX.XX useradd -G hdfs $username echo "" ssh root@192.168.XX.XX passwd $username echo "" echo -n "Usuario $username creado OK en Host2: " echo "" echo -n "Creando carpeta en hdfs: " su -l hdfs -c "hdfs dfs -mkdir /user/$username" echo -n "Carpeta $username creada OK en hdfs: " echo "" echo -n "Creando permisos...; espere...: " su -l hdfs -c "hdfs dfs -chown $username /user/$username" echo -n "Permiso creado correctamente: " echo "" su -l hdfs -c "hdfs dfs -chmod 755 /user/$username" echo -n "Usuarios $username creado satisfactoriamente y con permisos asignados: " #echo -n "asignando quota para el usuario $username .....; ok: " #hdfs dfsadmin -setSpaceQuota 5gb /user/$username hdfs dfs -ls /user/ echo -n "Muchas Gracias: " exit

2 REPLIES 2

Re: Create Users Linux Script - How restrict access users create from ambari view (file view) to upload and remove file for another users

Explorer

resolved...

remove the -G hdfs to script

Re: Create Users Linux Script - How restrict access users create from ambari view (file view) to upload and remove file for another users

Explorer

i fixed remove line "useradd -G hdfs" in my script