Lazarus
Programming => Operating Systems => Linux => Topic started by: a.atalla on July 07, 2010, 12:42:07 pm
-
i need the user name to use in my application
i couldnot found the function that returns the user-name in linux
-
GetEnvironmentVariable('USER');
-
GetEnvironmentVariable('USERNAME');
-
GetEnvironmentVariable('USER');
that works ,but now my application will run with root priviliage so that function will return "root" as the user name
is there any way i can list all the computer users "not only the current user" ?
-
What do you want to achieve?
Sounds like you don't know yourself ;-)
http://forum.lazarus.freepascal.org/index.php/topic,9770.msg48175.html#msg48175
-
GetEnvironmentVariable('USER');
this one was what i'm looking for but now i need another thing
my application will run on the user machine with root privilege ,and it will do some admin stuff on other users account ,so i need to know what the other users that use the computer
i wish that is clear
does the post u linked belongs to my question?
-
does the post u linked belongs to my question?
Yes.
-
It's easy.
Take a look at the users unit in the users fpc package. It contains everything you need. GetUserList, and GetUserData combined with FpGetuid from baseunix sounds like what you want :)
That's ofcourse a very unix specific unit :)