Append the command you would like to run to the /etc/profile
file. This will make it run for all users on login.
For remote logins (through SSH), you can modify the Banner
parameter of the /etc/ssh/sshd_config
file.
Also, modifying /etc/issue
and /etc/motd
might do what you're looking for as well.
As far as running a script only the first time a user logs in, this question was answered before here: Execute a particular command only for the first time in a shell