Operating System - HP-UX
1820243 Members
2507 Online
109621 Solutions
New Discussion юеВ

Re: environment variable logname

 
sukumar maddela
Occasional Advisor

environment variable logname

Hi all,

at the time of login, i am unable to find the environment variable "logname".
i am getting fallowing error

logname: could not get login name

and also i want to know where all these environment variable are stored.

thanks and regards,
sukumar
7 REPLIES 7
Muthukumar_5
Honored Contributor

Re: environment variable logname

It is LOGNAME not logname.

To find environment variable list then,

# env

will give it.

hth.
Easy to suggest when don't know about the problem!
RAC_1
Honored Contributor

Re: environment variable logname

As per man page of logname, logname commands gets the login name using getlogin call, which in turns checks it in /etc/utmpx.

May be that file is corrected. Create anew one and check. (Back up old one, in case required)
There is no substitute to HARDWORK
Torsten.
Acclaimed Contributor

Re: environment variable logname

"logname" is a binary and usually called in /etc/profile or .profile. it is setting the variable LOGNAME to the user name.
find the binary by typing
whereis logname
and you will get
/usr/bin/logname
the profiles are executed while you logging in and within the profiles are some commands to set various variables.
try
man logname
for more information.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
saju_2
Respected Contributor

Re: environment variable logname

Hi

There is no variable called logname in my login path also!!!!!

That means u have customized the /etc/profile or /$home/profile file to add an entry called logname. The command assigned to that variable is not working properly.

If u r getting this error for all users check the /etc/profile file and search for the string logname.

If u r getting this error only for ur loging name then open /home//.profile file and search for the string logname.

Most probably the problem will come for the variable PS1 in ur profile file. Proper command sustitution may not have done for that variable.

Regards
CS
Muthukumar_5
Honored Contributor

Re: environment variable logname

RAC is caught the correct thing. LOGNAME is a environement variable and logname is a binary to get current users user name. Try to execute it with command line as,

# logname
Is it working?

# ls -l /usr/bin/logname
-r-xr-xr-x 1 bin bin 12288 Nov 14 2000 /usr/bin/logname

May be you can get logname information as,

# who -mu | awk '{ print $1 }'

Or else,

write c coding to get logname or copy the binary from other hp-ux machine with same version.

hth.
Easy to suggest when don't know about the problem!
sukumar maddela
Occasional Advisor

Re: environment variable logname

i copied the good binary from some other server and i copied in to /usr/bin with proper permissions. then also that binary is no working..
Robert-Jan Goossens
Honored Contributor

Re: environment variable logname

it is possible that the /etc/utmp or /etc/utmpx file is corrupt.

Check this doc for more info.

Title: How to clear corrupted utmp/utmpx files
Document ID: KBRC00008608

Europe
http://www4.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000080000500

US
http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000080000500

Regards,
Robert-Jan