Hi, on windows we can check the event log for login event that is login type 3 RDP interactive login session.
On Linux and Unix OS, I need to detect SSH user interactive login where the user login from laptop / pc but not the ssh session initial by the script, the common is wtmp log, is that a way to identify?
root pts/1 1.1.1.1 Thu Aug 4 09:35 - 14:45 (05:09)
I can check the secure log for the root user but how do I know if root user are login via the script or application, I only need to capture if user login from the laptop / pc ssh client interactive login.
Gerwin Jansen
Which exact Linux version is this about? On Ubuntu for example, you have to look at /var/log/auth.log - lines with sshd in it.
You are very unclear, first you talk about a script, now sftp. Both ssh and sftp use the same port (ssh). I do not understand what you want.
Julio Jose
ASKER
apologize, I want to check exiting log for real user login with password using SSH client software
Steven Roman
Hello,
I think with the answers posted that should get you what you need.
Or are you wanting to be alerted by some way when someone does login to the Server?
If so you are looking for a script or crontab job. This will get more complex but can be done.
I have a script when ever someone logs in as root or su's in to send me an email
If someone starts an interactive session via ssh (or, $DEITY forbid, telnet), whether using the password or an ssh key, it's logged in wtmp (on AIX, HP-UX and Linux and I believe Solaris as well), and the `last` command will show that session.
If some runs `ssh root@yourserver "command"`, it's logged in syslog but not wtmp. That's still a security issue - Someone has direct root login and is using it, but it's harder to detect.
Setting PermitRootLogin = no in sshd_config solves the problem
Julio Jose
ASKER
So we should check WTMP to identify the user SSH interactive session?