Operating System - HP-UX
1822147 Members
4106 Online
109640 Solutions
New Discussion юеВ

Log telnet session username

 
Laszlo Csizmadia
Frequent Advisor

Log telnet session username

How is it possible to log which user is using telnet to login?
Inted -l logs only the hostname in the syslog but not the username, like:
May 17 13:50:28 aaenwh2 inetd[29548]: telnet/tcp: Connection from unknown (10.117.243.242) at Mon May 17 13:50:28 2004

As I see telnetd don't offer a logging capability in HPUX 11.X.
How to do then?

Thanks in advance...
9 REPLIES 9
Fred Ruffet
Honored Contributor

Re: Log telnet session username

Hi !

By adding some code in /etc/profile. Detect wether the session is telnet (the father of your shell process should be a telnetd). In that case, use logger to log aline in syslog.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Sanjay Kumar Suri
Honored Contributor

Re: Log telnet session username

You can use last/lastb to view history of successful/unsuccessful logins.

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Brian Hackley
Honored Contributor

Re: Log telnet session username

Lazsio,

A user that logs in via telnet has a TTY of pts/t** as viewed in ps -ef, who -a, or last output.

Hope that helps a little,
-> Brian Hackley
Ask me about telecommuting!
Bharat Katkar
Honored Contributor

Re: Log telnet session username

Hi there,

See if
# who -R

Helps in any way.

Regards,
You need to know a lot to actually know how little you know
Dave La Mar
Honored Contributor

Re: Log telnet session username

We routinely do this by placing the following in the /etc/profile and outputting to a file.

last -R | head -1

Best regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Geoff Wild
Honored Contributor

Re: Log telnet session username

We do this in .profile for root:

# Set up logging
HISTFILE=${HOME}/.sh_history_`who am i|awk '{ print $1}'`
export HISTFILE
date >>$HISTFILE
HISTSIZE=500
export HISTSIZE


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Dani Seely
Valued Contributor

Re: Log telnet session username

Hey Laszlo,
To find out who is accessing the system remotely (ftp, telnet, secure shell), I simply do:

# last -R |grep -v console

Very simple, hope this helps.
Together We Stand!
RAC_1
Honored Contributor

Re: Log telnet session username

If you have tcp wrappers. you can put the services in /hosts.deny and hosts.allow and then you will get everything logged in syslog.log

Like you want to allow ftp to all, the
/etc/hosts.allow will ike follows

ftp:ALL

Then whoever does ftp gets logged in syslog.log with username

Anil
There is no substitute to HARDWORK
Laszlo Csizmadia
Frequent Advisor

Re: Log telnet session username

As telnetd doesn't have any logging facility finally I putted this line in the /etc/profile:
who -mR|awk '{if(match($2, "pts\/t")) print}'>>/tmp/telnet.log

Thanks for the help...