Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!cmcl2!brl-adm!adm!csmoko@NSWC-OAS.arpa From: csmoko@NSWC-OAS.arpa Newsgroups: comp.unix.questions Subject: h Message-ID: <8560@brl-adm.ARPA> Date: Thu, 30-Jul-87 02:43:00 EDT Article-I.D.: brl-adm.8560 Posted: Thu Jul 30 02:43:00 1987 Date-Received: Sat, 1-Aug-87 04:36:31 EDT Sender: news@brl-adm.ARPA Lines: 40 > At our site we are running Ultrik 2.0 on a vax 8600. We have > created several group accounts that people (if they are in the right > group) access through a setuid program that has the same name as the > group account. > The program sets up a environment for them and then execs /bin/sh. > The person is then placed in that group account. What I would like to > do is have the shell execute the .profile and possibly /etc/profile. > Is there any way I can tell /bin/sh to execute .profile or > /etc/profile? I know I can have the user type . .profile but I do not > want this. Dennis, The method that I use is for /bin/csh but it should be similar for /bin/sh. When I want to exec a .login with /bin/csh, it must be fooled into thinking someone is logging on. When csh starts it tests to see if it was invoked as -csh. If so it first gets it commands from .login . I would guess that /bin/sh does a similar thing. The trick that I use involves changing the name of the process with the following program. I use the line ' $ exec execv /bin/csh -csh ' as the invoking command, because my machine has no chsh command. I can't assure you that your machine handles things this way but this may help. Chuck Smoko --------------------------------- Cut ------------------------ #include main(argc,argv) char **argv; { if (argc < 3 ) { fprintf(stderr,"usage: execv path arg0 [arg ....]\n"); exit(1); } execv(argv[1],&argv[2]); fprintf(stderr,"ERROR can't exec %s\n",argv[1]); exit(1); }