Changing user while executing script [message #195557] |
Fri, 29 September 2006 08:02 |
athyzafiris
Messages: 5 Registered: September 2006 Location: Switzerland
|
Junior Member |
|
|
The problem is that i am executing a bourne shell script as one user which is fine but i have to copy a file that the user executing the script does not have access to therefore i have to change to another user. I want my script to relogin as the different user copy the file and logout coming back to the original user. I don't want the script to prompt the user for a password as i already know the password of both users and would hardcode the passwords in the script. Or if there is away to change users without considering the passwords at all that would be great.
If anyone can help me it would be much appreicated.
I don't want to do any system changes as this script will be run on different systems so i want the script to control everything.
|
|
|
|
Re: Changing user while executing script [message #195762 is a reply to message #195628] |
Mon, 02 October 2006 04:10 |
athyzafiris
Messages: 5 Registered: September 2006 Location: Switzerland
|
Junior Member |
|
|
i have read through a number of documentation but how do i go about setting a SUID on the executable in the script.
Do i chmod 4000 the script as root before i execute it as a different user when i am logged in as that user? Or in the script do i chmod 4000 when executing the copy?
[Updated on: Mon, 02 October 2006 05:00] Report message to a moderator
|
|
|
Re: Changing user while executing script [message #195823 is a reply to message #195762] |
Mon, 02 October 2006 11:53 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
you need to decide on the permissions you want to set. You add the "4" to the front of your regular parmissions. So if you would normally set the file to 755, you now set it to 4755 (from the program owner). It probably won't work on a script - only a program - becuase of security issues. It depends on your OS.
|
|
|
|