USER envionment variable - Aix

This is a discussion on USER envionment variable - Aix ; Hi, Found some hits in this group but no straight answer. Is the environment variable USER on AIX 5.2/5.3 a reserved environment variable? And where is is set by default? Kind regards, Peter...

+ Reply to Thread
Results 1 to 4 of 4

Thread: USER envionment variable

  1. USER envionment variable

    Hi,

    Found some hits in this group but no straight answer.
    Is the environment variable USER on AIX 5.2/5.3 a reserved environment
    variable?
    And where is is set by default?

    Kind regards,

    Peter

  2. Re: USER envionment variable

    In
    news:698e5ff7-2706-420e-b297-7abbeb13e536@b15g2000hsa.googlegroups.com,
    Peter typed:

    > Hi,
    >
    > Found some hits in this group but no straight answer.
    > Is the environment variable USER on AIX 5.2/5.3 a reserved environment
    > variable?
    > And where is is set by default?


    I think it's hardcoded and set by the daemons.

    A fragment of session.c from openssh

    --- row 1034 ---------------------
    if (!options.use_login) {
    /* Set basic environment. */
    for (i = 0; i < s->num_env; i++)
    child_set_env(&env, &envsize, s->env[i].name,
    s->env[i].val);

    child_set_env(&env, &envsize, "USER", pw->pw_name);
    child_set_env(&env, &envsize, "LOGNAME", pw->pw_name);
    #ifdef _AIX
    p = fchild_set_env(&env, &envsize, "LOGIN", pw->pw_name);
    #endif
    child_set_env(&env, &envsize, "HOME", pw->pw_dir);
    ----------------------------------------


    --
    Regards
    Piotrek Kapczuk


  3. Re: USER envionment variable

    On Nov 29, 3:18 pm, Peter wrote:
    > Hi,
    >
    > Found some hits in this group but no straight answer.
    > Is the environment variable USER on AIX 5.2/5.3 a reserved environment
    > variable?


    Not that i know.

    > And where is is set by default?


    The USER variable is set by the login/rlogin/ssh process during login.

    The LOGNAME variable is readonly and set in the /etc/profile . Of
    course the /etc/profile can be extended to set the USER variable as
    well to readonly.

    hth
    Hajo

  4. Re: USER envionment variable

    On Nov 29, 3:21 pm, Hajo Ehlers wrote:
    > On Nov 29, 3:18 pm, Peter wrote:
    >
    > > Hi,

    >
    > > Found some hits in this group but no straight answer.
    > > Is the environment variable USER on AIX 5.2/5.3 a reserved environment
    > > variable?

    >
    > Not that i know.
    >
    > > And where is is set by default?

    >
    > The USER variable is set by the login/rlogin/ssh process during login.
    >
    > The LOGNAME variable is readonly and set in the /etc/profile . Of
    > course the /etc/profile can be extended to set the USER variable as
    > well to readonly.


    Remember that any "readonly" shell variable, including LOGNAME, can be
    changed to "not readonly" by "typeset +r ".

+ Reply to Thread