Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2014
    Posts
    5

    Unanswered: Script to append user details as soon as he logs in

    I'm wishing to create a log myself where :
    I want to write a script in /bin folder to make a separate log in var/log folder & call it script in bashrc for each user login & I'm trying to avoid CRONJOB as it would take too much of my memory.
    The usage of bashrc isn't particularly clear and as and when someone logs in, I need that login detail to be appended to the log immediately. I think you understand what I'm trying to do without using too much of memory and space.

    What script should I use? And how to use it in bashrc?

  2. #2
    Join Date
    Apr 2014
    Posts
    5

    Script to append user details automatically from startup

    I'm wishing to create a log myself where I wish to:
    1.Write a script in /bin folder to make a separate log in var/log folder &
    2.Call the script in bashrc each time a user logs in, I'm trying to avoid CRONJOB as it would take too much of my memory after iterations. So I just need to append the user details (user id, ip, date, time & duration of login)
    The usage of bashrc isn't particularly clear to me and as and when someone logs in, I need that login detail to be appended to the log immediately. I think you understand what I'm trying to do without using too much of memory and space.

    What script should I use?

  3. #3
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Create a .profile file for each user in their home directory.
    Add the following line.
    Code:
    echo `date` $LOGNAME >>/var/logs/login.log
    If you are using ssh you could also add the client IP address.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •