LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-19-2023, 08:14 AM   #1
ratan61
LQ Newbie
 
Registered: Aug 2023
Posts: 29

Rep: Reputation: 0
Angry service accounts last logged in.


Hello All,

I need some info whether a service account:xyz which is not in use for a longer time. We want to disable the account which are not used but we do not know whether the account is being used /active by any application. I use lastlog command and find out the last loggedin users where this service account:xyz has recently logged into any system. Is there any other way to find out whether a user has recently logged in or not apart from lastlog ?

Please help
 
Old 12-19-2023, 09:19 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
service users usually not logged in. The processes, which belong to those services will use them, but without logging in.
For example on my host the service mosquitto is started when I boot the host and the user mosquitto will be the owner of the process (which is in turn mosquitto again)
 
Old 12-19-2023, 09:51 PM   #3
ratan61
LQ Newbie
 
Registered: Aug 2023
Posts: 29

Original Poster
Rep: Reputation: 0
Ok, I understand the point that service accounts will not be logged in and instead the processes uses it but there would be no trace of user account tologin.
Now another query here: a user account to track their last logged in , Is lastlog only method ??which other ways the user can login and how to trace their login.
Please note the user account have been created long time ago , probably 2 years or more. Apart from the /var/log/secure or /var/log/messages , is there a way to track.

Last edited by ratan61; 12-19-2023 at 09:53 PM.
 
Old 12-20-2023, 12:51 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
it depends on how did they log in (using ssh, or any other method). Usually these tools have logging capabilities, therefore you can check those log files, if available.
You can use the commands last, who, and probably others too. But there can be cases.... It depends on the host, the number of users and installed software

Last edited by pan64; 12-20-2023 at 02:37 AM.
 
Old 12-20-2023, 02:28 AM   #5
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,798

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
On my system sshd and su update the lastlog, but not sudo.
Some desktop logins update it.
The last command uses wtmp (a DB file) that should be updated whenever a terminal is involved, but some terminal tools refuse to update wtmp.
It's a mess.
/var/log/secure is updated if PAM is involved, so should work with su, sudo, sshd.
I think the only reliable method is to enable process accounting.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Get first day of last month and last day of last month in bash xowl Linux - Software 18 02-09-2017 09:49 AM
Listing of last logged in users (last command) rpascua Linux - Newbie 4 03-21-2014 01:31 AM
checking for user who are logged in, the display first,last name and time logged in LBP74 Programming 1 01-07-2013 04:23 AM
Block User accounts who has not logged in to the server last 2 months aksharb Linux - Security 11 03-14-2011 11:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration