is there a way to get logged in user name from linux daemon? I tried
seteuid(1000);
std::string userName = getlogin();
But seems that this call fails and my application is terminated after.
The general situation is following: some script that runs my daemon process. Inside of this daemon I start another UI process (lets call it A). Then in process A I'm trying to get logged in user name with way, described earlier. And my process A is terminated after getlogin
call. Is there any reliable way to get logged in user name from process A?