Skip to main content
Sanaz_janbakhsh
Gold ⭐️
October 20, 2016
Solved

Running Apache NiFi as a Non-Root User Safely and Correctly

Hi ,

NIFI was installed before with root user in our enviorment, now in order to switch it to non-root user, i'm wondering if you can help in the steps that i need to follow. Should i clean and re-install it again?

The version is 2.4.2.0

Thanks

SJ

MattWho
MattWhoAnswer
Titanium ⭐️⭐️⭐️
October 20, 2016
@Sanaz Janbakhsh

Re-installing from scratch is not necessary. Shutdown your NiFi instance, create the user on your system that you want to run NiFi as and change ownership of all the files and directories used by NiFi to that user. This includes all 4 NiFi repositories (Database, Provenance, Content, and FlowFile). The "NiFi user" must be able to read and write to the repos, nifi logs, and state directories. If you are unsure where to find these directories your user needs access to, look in the various config files found in NiFi's conf directory. NiFi will be able to continue working on FlowFiles that were still active in the flow as long as ownership of those files was successfully changed. After that you can either start NiFi while logged in as that new user or set the "run.as=" property in the NiFI bootstrap.conf file. After starting NiFi as the user, tail the nifi-app.log and watch for any permission denied errors. If you encounter any, adjusted permissions on the reported file/dir and you should be good to go.

There is no such thing as NiFi version 2.4.2.0? Are you running an Apache Nifi release (0.x or 1.x) or a HDF release (1.x or 2.0)? You can see your NiFi version by clicking on "about" in the upper right corner of the NiFi UI.

Thanks,

Matt

9 replies

MattWho
Titanium ⭐️⭐️⭐️
MattWhoAnswer
Titanium ⭐️⭐️⭐️
October 20, 2016
@Sanaz Janbakhsh

Re-installing from scratch is not necessary. Shutdown your NiFi instance, create the user on your system that you want to run NiFi as and change ownership of all the files and directories used by NiFi to that user. This includes all 4 NiFi repositories (Database, Provenance, Content, and FlowFile). The "NiFi user" must be able to read and write to the repos, nifi logs, and state directories. If you are unsure where to find these directories your user needs access to, look in the various config files found in NiFi's conf directory. NiFi will be able to continue working on FlowFiles that were still active in the flow as long as ownership of those files was successfully changed. After that you can either start NiFi while logged in as that new user or set the "run.as=" property in the NiFI bootstrap.conf file. After starting NiFi as the user, tail the nifi-app.log and watch for any permission denied errors. If you encounter any, adjusted permissions on the reported file/dir and you should be good to go.

There is no such thing as NiFi version 2.4.2.0? Are you running an Apache Nifi release (0.x or 1.x) or a HDF release (1.x or 2.0)? You can see your NiFi version by clicking on "about" in the upper right corner of the NiFi UI.

Thanks,

Matt

Translate
Sanaz_janbakhsh
Gold ⭐️
October 20, 2016

Hi Matt,

Thanks alot for the comment, it is really helpful. I'm running HDF version . i hope this is the one that you recommend.

SJ

Translate
Sanaz_janbakhsh
Gold ⭐️
October 25, 2016

Hi Matt,

The solution perfectly helped me and fixed my issue. I don't know how to accept the answer though. 🙂

SJ

Translate