Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7782553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:34:47+00:00 2026-06-01T19:34:47+00:00

When I login in Linux Suse10 machine and check for getlogin_r() through a C++

  • 0

When I login in Linux Suse10 machine and check for getlogin_r() through a C++ program, i get a proper result as my login name.

int main()
{
    char szUserName[64] = {0};

    int nGet = getlogin_r(szUserName, sizeof(szUserName)-1);
    if(0 != nGet)
        {
            printerr();
        }
    printf("%s\n", szUserName);
    char * szHome = getlogin();
    printf("%s\n", szHome);
    return 0;
}

But after using the su – name2
i have changed the login now.
But getlogin_r() still shows the older usename.

One solution is the use of geteuid(). But what is the reason of above problem

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:34:49+00:00Added an answer on June 1, 2026 at 7:34 pm

    “after using su - name2 I have changed the login” – No, you haven’t. You’ve changed the user id, not the login.

    The man page for su says this about the - option: “Provide an environment similar to what the user would expect had the user logged in directly.” Apparently “similar” is different than “identical to”. Specifically, su - does not store a login record in /var/run/utmp.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using c in linux, when i run main.c i get below error:
We are several persons using the same login id on Linux Box. I want
I can't login to github with generated ssh-keys. I've followed this manual: http://help.github.com/linux-key-setup but
First, context: I'm trying to create a command-line-based tool (Linux) that requires login. Accounts
Login Form: $authAdapter = Zend_Registry::get('authAdapter'); $authAdapter ->setIdentity($formData['email']) ->setCredential($password) ->setCredential(1); Bootstrap: protected function _initAuth(){ $this->bootstrap('db');
When 'login' button is clicked I would like to iterate through a column in
I have installed MySQL server 5 on redhat linux. I can't login as root
environment: Ubuntu 9.10 Eclipse eclipse-jee-galileo-SR2-linux-gtk When I login the ubuntu,and run the eclipse, it
I have been tasked with installing node.js on a linux server, the login information
Good day everyone I need to execute command on linux machine this command is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.