c-shell script won't run from korn-shell / SETUID

c-shell script won't run from korn-shell / SETUID

Post by Steve Conro » Fri, 10 Nov 1995 04:00:00



Greetings,

I have a C program called "tryme" which does a system call
to run a korn-shell script called "trythis.ksh".  This script
calls a C-shell script called "goforit".

My original program "tryme" runs SETUID as user "joe" so
the permissions on "tryme" look like this:

     -rwsr-x---  1 joe   sd   3083 Nov  9  19:06 tryme

The two scripts are executable by everybody.  When I run "tryme"
it calls "trythis.ksh" without problems, but when "trythis.ksh"
then calls the C-shell script "goforit", an error is produced
saying:

    "csh: The file access permissions do not allow the specified
     action."

When I turn off the SETUID permission from tryme and the rerun
it, everything works just fine.  Does anybody know why turning
on SETUID for tryme has an adverse affect on the c-shell script?

-Steve

 
 
 

c-shell script won't run from korn-shell / SETUID

Post by Reese Faucett » Mon, 13 Nov 1995 04:00:00



>    "csh: The file access permissions do not allow the specified
>     action."

>When I turn off the SETUID permission from tryme and the rerun
>it, everything works just fine.  Does anybody know why turning
>on SETUID for tryme has an adverse affect on the c-shell script?

I suspect its because of the code in csh that says:
        if (not batch mode AND geteuid UID != getuid UID) {
                exit with permission denied;
        }

Looks like csh is trying to be security conscious.
You can do what you ask with the "-b" (batch mode) flag, I beleive.
In your ksh script, trythis.ksh, use "csh -b goforit" to run your
csh script.  As long as the csh script doesn't need to be interactive,
this should fix you up.

Regards,

---------------------

        Excellent AIX Tools  --  http://www.tkg.com/

 
 
 

1. Shell Script Help (C-Shell Script)

In my class we had to write a C program and now we have to write a shell
script to do the exact same thing. I am not sure where to get started using
tr and sed to accomplish this assignment. Here is the assignmnet...

--------------------------------------------------------------
(1) remove all non-printing characters (character codes 1 through 31,
   and 127) and replace them with the same sort of codes the vi
   editor uses.  For example, the bell character (character code 7)
   is replaced by the two printable characters "^" and "G" (G is the seventh
   letter of the alphabet).  Appendix I of Foster lists the ASCII character
   set, and it shows all the proper two-character sequences that should
   be used for the non-printing characters.  There are two special cases:
   Replace the delete character by "^?".  Newlines should be replaced by a
   dollar sign ("$") and then an actual newline.
   **you may ignore NUL (character code 0)**

(2) delete all non-ASCII characters (those with character codes 128 through
255).

(3) truncate all output lines that would otherwise extend past column 72.
Begin
   reading the data on the next line after ignoring the rest of the
character past column 72.

Make sure it reads from stdin and prints to stdout.  It should be comprised
of standard UNIX utilities (that is, it should not invoke any specialized C
programs
that you may consider writing). You MUST make use of pipes rather than using
files to store intermediate results.  Don't make this assignment
unnecessarily hard: the whole program can be done in ONE line (not counting
all the documentation lines).
--------------------------------------------------------------

I was thinking that (1) could be accomplished by using a tr line like ( tr
'\001-\011' '\136') but that replaces some of the non printing with the ^,
how would i get the letter in there and would I have to have a bunch of
those tr commands piped together just to accomplish (1)?

Some help on this would really really be appreciated as its due on Monday
and I've hit a brick wall on this one.

-mogrefy

2. Running KDE and Gnome at the same time?

3. Korn shell vs C-shell

4. x86 sol 2.4 ppp summary

5. Q: "remsh" - Korn shell vs C-shell

6. Need Cirrus CL-GD5434 Info/Config

7. C-Shell / Korn Shell troubles ...

8. comp.unix.sco Technical FAQ (2/3)

9. Clear screen while running C-shell script based on echo's

10. Convert Bash shell script to Korn shell script

11. a question about executing a shell script (c-shell)

12. Korn Shell's equivalent of the C Shell's !*

13. best korn shell resources and is there a korn shell faq