Run a script post login linux

10,577

Assuming all your users are using bash, then the file /etc/profile is executed on login. On some distros there is an /etc/profile.d. You could drop your login script into this directory.

Share:
10,577

Related videos on Youtube

RealWorld
Author by

RealWorld

Updated on September 18, 2022

Comments

  • RealWorld
    RealWorld almost 2 years

    I would like to run a script after a linux user logs in to do some additional security checks. The user should first login normally using their password, but then be checked with my script, and then get full access to the system. Is this possible?

    • Zoredache
      Zoredache almost 10 years
      Are you sure you really want to have it happen post-login? With PAM you can do a lot of checking.