Help: how to determine local host name after 'su -' command?

Help: how to determine local host name after 'su -' command?

Post by Anthony V. Gavrilov - Sr. Programmer - IF » Sat, 01 Jul 1995 04:00:00



I use the startup shell script that allows to set DISPLAY variable
while logging to remote host:

xtty=`tty | cut -c6-15`
h2=`who | grep $xtty | tr -d '()'`
xc=`echo $h2 | wc -w`
if [ $xc = 6 ]; then
echo $h2 | awk '{ print $6 }'
else
hostname
fi

But this doesn't work after 'su - user'. Does anybody know how to solve
this problem?

Thanks in advance.

Anthony V. Gavrilov

 
 
 

1. How to determine local host name after 'su -' command

I use the startup shell script that allows to set DISPLAY variable
while logging to remote host:

xtty=`tty | cut -c6-15`
h2=`who | grep $xtty | tr -d '()'`
xc=`echo $h2 | wc -w`
if [ $xc = 6 ]; then
echo $h2 | awk '{ print $6 }'
else
hostname
fi

But this doesn't work after 'su - user'. Does anybody know how to solve
this problem.

Thanks in advance.

Anthony V. Gavrilov

2. GETTING ERRORS INSTALLING SNMP,KERBEROS

3. : how to determine local host name after 'su -' command?

4. Where should I put my swap partition?

5. How to determine local host name after 'su -' command?

6. Help! Swap config.

7. httpd can't determine local host name

8. mod_ssl and Authentication

9. MD5 disabled the 'su' and 'logon' command

10. can't resolve local host name , help !

11. 'su ' vs. 'su -'

12. restrict use of 'su' or 'su -'

13. Help: getting error "httpd: cannot determine local host name"