Re: older Red hat versions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1) My friend has written a script and wants it to automatically run if a
certain user logins in( how can he add the script to automatically run
when he logs on)

There are many ways to accomplish this, depending on complexity, which vary slightly depending on the "certain user's" choice of shell.


If you don't mind that the user can see and mess with this functionality, just add a line to run the script into the user's startup files (~/.profile for bash or ~/.login for tcsh).

If you don't want the user to know, then the following might be more useful:

For tcsh and csh, the administrator could edit /etc/csh.login, which gets executed (before the user's .login) on login and add something like:
if ( $USER == "username_in_question" )
/bin/sh /etc/script_to_run.sh
[or]
include /etc/script_to_run.csh
endif


For bash and sh, edit /etc/profile instead with something like:
if [ "$USER" == "username_in_question" ]; then
     . /etc/script_to_run.sh
		[or]
     /bin/csh /etc/script_to_run.csh
fi

WARNING: Many countries have laws regarding how and if one may be monitored without notification. If your friend intends to use this to covertly log or monitor unaware users (and not for other useful purposes or geneeral amusement) he/she should check his/her locally applicable laws.




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux