I'm working on a machine where I don't have root, but there is a list of allowed
sudo commands. One of these commands is
/bin/su - foouser. So I can type
sudo su - foouser, and I get an interactive shell as foouser. Then I can run some stuff as
The problem is that
foouser is a shared user/shell that is used for spawning certain important production processes. I can't easily customize it or set it up the way I want. And I shouldn't be working in it consistently which splits up my terminals, and command history between ones where I'm logged in as myself and ones where I'm
What I'd really like to do is to have a way to run a single command as
foouser, have it block, print out stdout and stderr to my shell as a command usually would, and then return with me still logged in as myself (and not
foouser). This could e.g. be encapsulated in a script so that
as_foo bar runs the command
foouser, prints stdout and stderr, returns return code of
bar, and then puts me back in my shell.
I can ask the sys admins to change permissions. For example, they could add
bar to the sudo list, and then I could use (I think)
su -c to run bar in the fashion I described. But then if the next day I want to run
bar2, I have to talk to them again.
Is there any way out of this dilemna? It seems rather silly because I obviously can become
foouser and run as many commands as I want, so there is no difference in terms of security that I can see. Just can't find any obvious convenient way to make this possible.