0

I am deleting a user in Solaris 10 and 11.  If I delete a user using the command

userdel -r test1

and then check my lastlog file /export/home/ch185140/lastlog, I get output like this:

1    tj100201  Tue Jan  8 15:10:19 2019  pts/5     abc-as6500-n
2    tj100202  Fri Dec 28 01:03:01 2018            abc.otn
3    tj100203  Tue Jan  8 15:37:46 2019  pts/6     sabc.otn]
21             Wed Dec 26 00:09:47 2018  pts/3     abc-cdo
252  tj100204  Mon Jan  7 10:54:38 2019  pts/4     wabc-cdo

It would appear that the “lastlog” entries do not get deleted when a user is removed from the system what I can see is

useradd -c "test2" -u  -d /export/home/tj125100 -m tj125100

check entries of lastlog file:

1    tj100201  Tue Jan  8 15:10:19 2019  pts/5     abc-as6500-n
2    tj100202  Fri Dec 28 01:03:01 2018            abc.otn
3    tj100203  Tue Jan  8 15:37:46 2019  pts/6     sabc.otn]
21   tj125100  Wed Dec 26 00:09:47 2018  pts/3     abc-cdo
252  tj100204  Mon Jan  7 10:54:38 2019  pts/4     wabc-cdo

It is overwriting the details of the user that was deleted, because his entries were not removed completely.

If we create a new user, it will overwrite properties of the previous user. Why aren't the entries removed completely from the lastlog file?

Is there any way to remove last log entries for user that is deleted.

  • And the question is? – Romeo Ninov Jan 8 at 14:32
  • 2
    Do not create users with duplicated names. This is by good practice – Romeo Ninov Jan 8 at 14:41
  • 1
    @RomeoNinov Even deleting users is bad practice. When you do that, now it's almost impossible to tell who owned the files left behind. And if the UID gets reused, any files left behind will be owned by the new user. – Andrew Henle Jan 9 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.