kpfuser
11-02-2007, 05:28 PM
Just as I thought that I was getting a bit familiar with bash, there came the following perplexing puzzle:
knoppix@1[my-scripts]$ su
root@1[my-scripts]# ls -l
total 32
-rwxr-xr-x 1 knoppix knoppix 1090 Nov 27 2006 my-html-script
root@1[my-scripts]# my-html-script > my-file.html
bash: my-html-script: command not found
root@1[my-scripts]# gedit my-html-script
root@1[my-scripts]# gedit my-html-script
root@1[my-scripts]# exit
exit
knoppix@1[my-scripts]$ my-html-script > my-file.html
knoppix@1[my-scripts]$
As it can be seen from the above, although su has permission to run my-html-script, the latter does not run. The same script runs normally for user knoppix. Furthermore, although su is not permitted to write to my-html-script I was able to modify the latter while logged in as su. How come?
knoppix@1[my-scripts]$ su
root@1[my-scripts]# ls -l
total 32
-rwxr-xr-x 1 knoppix knoppix 1090 Nov 27 2006 my-html-script
root@1[my-scripts]# my-html-script > my-file.html
bash: my-html-script: command not found
root@1[my-scripts]# gedit my-html-script
root@1[my-scripts]# gedit my-html-script
root@1[my-scripts]# exit
exit
knoppix@1[my-scripts]$ my-html-script > my-file.html
knoppix@1[my-scripts]$
As it can be seen from the above, although su has permission to run my-html-script, the latter does not run. The same script runs normally for user knoppix. Furthermore, although su is not permitted to write to my-html-script I was able to modify the latter while logged in as su. How come?