When Ranger service is configured for using custom PID file location and custom user using HDP-2.5, below steps need to be followed.
1) Edit ranger-admin-services.sh script file: This file is located at /usr/hdp/current/ranger-admin/ews/ranger-admin-services.sh which have hard-coded default path as pidf=/var/run/ranger/rangeradmin.pid.
Need to update the hard-coded path with the custom value specified from Ambari in ranger_pid_dir property under Advanced ranger-env section.
Also update the hard-coded user used for chown {pidf} with the service user’s name given during installation of Ranger service on a Misc Tab from Ambari.
Update PID location:
pidf={custom_pid_path}/rangeradmin.pid
Update service user:
chown {custom_user} ${pidf}
2) Edit ranger-usersync-services.sh: This file is located at /usr/hdp/current/ranger-usersync/ranger-usersync-services.sh. Similar changes are required to update the hard-coded pid location and hard-coded service user for Ranger Usersync component.
Update PID location:
pidf={custom_pid_path}/usersync.pid
Update service user:
chown {custom_user} ${pidf}
3) Start Ranger Service: Start Service from Ambari