Forum > Linux

how to get the username

(1/2) > >>

a.atalla:
i need the user name to use in my application
i couldnot found the function that returns the user-name  in linux

theo:
GetEnvironmentVariable('USER');         

typo:
GetEnvironmentVariable('USERNAME');   

a.atalla:

--- Quote from: theo on July 07, 2010, 12:55:34 pm ---GetEnvironmentVariable('USER');         

--- End quote ---

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" ?

theo:
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

Navigation

[0] Message Index

[#] Next page

Go to full version