Q:

Fabric su with sudo

I have the following procedure that I need to implement in Fabric:

su newuser  
cd /newuser/bin/  
sudo ./script.sh 

I tried to implement the solution here
switch to different user using fabric 
but it doesn't work for me.
I get "Must be logged on as root or user with sudo privileges" which means sudo
didn't work for some reason.
Strangely enough when I put the sudo in the sending command ie:
execute(su, pwd, 'newUser', sudo('./script.sh'))
it seems it works but not as newUser but as been executed by the old user.
Any ideas ? Is there another implementation I can use ?

A:

Since I tried many things around and not being able to find a solution,
I decided to have a workaround.
I ssh directly with the new user so to avoid the su and then sudo. 
Of course this only works if your newuser can ssh to the node 

