Adding commands to be called at login time is not bullet proof.
A more secure approach is changing the default shell by a program that only do what you need. Using your case, that program could be something like that:
Quote:
#!/usr/bin/rbash
/usr/bin/tail -f /var/log/messages
|
rbash is the bash shell operating in a restrict way. RTFM.
To setup this, change the last last entry in /etc/passwd to the path of such program, for example, /home/joe/readlog. In some systems you may have to add this program to the /etc/shells file, which controls what are the valid shells in you system.
Answering your second question, I am not sure what you want, but if you change the /var/log/messages to /var/log/afixedname in the above script and you want to associate the real file /var/log/messages to it,
ln -s /var/log/message /var/log/afixedname
now, if you want the same user, get the output of /var/log/boot.msg, using the same script,
rm /var/log/afixedname
ln -s /var/log/boot.msg /var/log/afixedname
best regards,
PS: change the user's shell only after you have tested the script /home/joe/readlog. Doing this make the debuging of /home/joe/readlog very easy. When all looks fine, than change the user's shell to /home/joe/readlog.
PS2: Start with the regular shell /bin/bash. After debugging, than change to the restrict shell until you manage it to work as expected.