On Thu, Sep 20, 2001 at 09:09:57PM +0530, Logu wrote:
> 
> Which script or file is sure to excute when a particular 
> user logs-in by any means.  That is a  user can login in 
> the system console or remote terminal or he/ she  can su 
> from some other logins.
> 
> I want to retrict the user to a customised  screen after 
> logging-in,like a router or switch configuration screen. 
> They should not be able to use any other commands except 
> what is given in the menu.
> 
> I tried .bashrc, .bash_profiles but  it is  not  getting 
> excuted if the user is switched  from one user to  other 
> using su command.
> 
> --__--__--
---end quoted text---

This is a difficult thing to  achieve if you  permit shell
access from your menu. You  need to do it  something  like
what vsnl used to do for shell accounts.

Have a look at a shell script called "1bbs" ... this  is a
very old program, don't know if it is on the net now ... I
can mail you a tarball if needed. 

You should not permit su entries, since in su the $USER is
still  the  original user  whereas "whoami" is root/ other
user. There is no login  process or re-reading of .bashrc.
If somebody does su to this user, then just send  him back
to his territory by adding  something like  this script to
be called from the first line of .bashrc:

#!/bin/bash
WHOISIT=`whoami`
if ! [ "$USER" = "$WHOISIT" ]; then
   echo "You are treading on forbidden territory .."
   su $USER
fi

HTH

Bish
      
-- 
:
####[ Linux One Stanza Tip (LOST) ]###########################

Sub : No password login as user                      LOST #116

Fed up of typing password for every login as an user on stand-
alone boxes ? Edit /etc/login.defs.  NO_PASSWORD_CONSOLE field
should have tty names ( e.g. example below permits no password
logins for tty4,tty5 and tty6):
NO_PASSWORD_CONSOLE       tty4:tty5:tty6

####<[EMAIL PROTECTED]>####################################
:

_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to