I am trying to run a specific script that allows me to do some file-maintenance. The script runs error-free and does what it is supposed to do. In fact I am supposed run this script (Bourne shell) as a normal user and not as "root". However, at some point in the script one of the binaries extracts the files which I need to rename later in this shell script.
This binary extracts these files as user "root" and group "other". When I try to executre "mv" comnmand to rename these files it would obviously fail to execute as it is run by a normal user. If I switch to "root" user I can rename the file through this same shell script. (Commenting out the lines previous for testing).
I need to be able to run this application using normal user ID and because of this binary, I need to switch to "root" user at the end, so that I can rename these large number of files.
How can I switch to root ID within the script and be able to run this command?
e.g.
#!/bin/sh
< normal user script flow>
....
.....
.....
.....
< portions of the script requires "root" user ID>
......
......
......
<switch it back to normal user....>
Will appreciate any help...
This binary extracts these files as user "root" and group "other". When I try to executre "mv" comnmand to rename these files it would obviously fail to execute as it is run by a normal user. If I switch to "root" user I can rename the file through this same shell script. (Commenting out the lines previous for testing).
I need to be able to run this application using normal user ID and because of this binary, I need to switch to "root" user at the end, so that I can rename these large number of files.
How can I switch to root ID within the script and be able to run this command?
e.g.
#!/bin/sh
< normal user script flow>
....
.....
.....
.....
< portions of the script requires "root" user ID>
......
......
......
<switch it back to normal user....>
Will appreciate any help...