LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-23-2008, 01:58 PM   #1
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Rep: Reputation: 31
Get user LOGNAME from a C++ program?


Is there a way to do this without having it passed as an argument?

What if it the program is running using the SUID bit and I want to know what user called the program rather than the more privileged user the program is running under.
 
Old 08-23-2008, 02:10 PM   #2
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
nevermind!

getenv("LOGNAME");

it even gets the name of the user that logged in, not the name of the user who is running the process!!

exactly what I needed. I just need to learn to phrase my google searches better.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Start a program for a user as root, with process belonging to user gnashley Programming 4 03-19-2007 01:58 PM
C program to see user log on in system and print user with real user name also naveen245 Programming 2 12-21-2005 12:53 AM
Use of LOGNAME for non-unique user ids Geoff_Hawke Linux - Newbie 1 10-13-2005 12:37 AM
Repeated Log Entry: sshd: authentication failure; logname= uid=0 360 Linux - Security 1 10-07-2005 12:23 PM
logname: no login name, -bash: [: too many arguments da_kidd_er Linux - General 1 10-27-2004 02:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration