Hi all,
Ok, bear with me on this one, I am a bit new to Unix and it might take me a little bit of time to articulate my question.
I know that every process has a user id and an effective user id. This seems to include the shell itself, because when I type 'ps', I see 'bash' listed as a process, and if I select the right options I can see that the uid and euid of 'bash' match my own uid.
user@tux:~$ ps -o "uid euid cmd"
UID EUID CMD
1000 1000 bash
1000 1000 ps -o uid euid cmd
user@tux:~$
I also know that you can user the 'su' command/script to create a new child shell with a different 'user' to the parent shell. Both the uid and euid of the new shell will be different to the old shell.
My question is, simply: is there any way of changing the effective user id of the shell you are in, instead of creating a subshell?
My (unlearned) gut feeling is that this should be possible, because I can write a 'C' program that changes its own euid 'on the run', and since c programs and shells are both processes, why shouldn't a shell be able to change its own euid (following a command from the user)?
I note that c's 'seteuid' function is called a 'system call', shouldn't it be even easier/more straightforward to make system calls straight from the shell?
Thanks in advance for any answers.
My reason for asking this question simply to deepen my understanding of unix.