> sh cd /u/zfs;su;pax -rwvCMX -p eW . /u/hfs

This does not do what you think it does. The pax command will run under the 
initial uid and not with uid=o as you might hope. I recently explained this on 
the RACF-L list as follows:


Starting in the initial shell process, most (shell) commands will be run in a 
new child process of this parent shell process. If you issue "sh" you will end 
up in a new sub shell process. The parent shell is waiting for the sub shell to 
end. Issuing "su" is also startting a sub shell in a new process, but will 
additionally try to switch to uid=0 in the *new subshell process*. Again the 
parent shell will wait for the sub shell to terminate, before it will run the 
next command. At that time, the uid=0 sub shell process has ended, so the uid=0 
environment does no longer exist. The next command is again starting with the 
initial parent shell's environment.


The ";" separates shell commands; they are run sequentially. Same with "&&" and 
"||", they just add the "run only if previous command ran successfully (&&) or 
unsucessfully (||)" to it. Still most commands are run in subshells.

To run commands in a "su" shell environment, you have to write all the commands 
into a UNIX file first, and then call "su" by redirecting stdin to that UNIX 
file.


echo "id" > /tmp/sucommandfile
su < /tmp/sucommandfile


This will show uid=0, because it is the sub shell (uid=0), which is reading 
from /tmp/sucommandfile as if it was stdin, and execute the commands found 
therein.
--
Peter Hunkeler

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to