|
From: | Carlos García |
Subject: | Re: [Fab-user] How to switch to a account and run some commands. |
Date: | Mon, 9 Jan 2017 10:26:17 +0100 |
Hi santosh,
can you use sudo
on the target host? I think it’s the easiest way:
from fabric.api import sudo
sudo('id', user='oracle')
sudo('whoami', user='oracle')
If not, you should run:
from fabric.api import run
run('su - oracle -c id')
run('su - oracle -c whoami')
To ease its usage you can create a context manager, similar to prefix()
, but you will have to handle the way to pass the oracle
password.
Regards
2017-01-09 9:06 GMT+01:00 santosh kumar <address@hidden>:
santosh DThanks,Please do let me know how can i achieve this on multiple nodes.EOFwhoamiidssh <hostname> 'su - oracle' <<EOFso i can achieve this in shell in this formate$ whoami$ idonce logged in as user oracle need to run some commands from there#su - oracleAll,I have a requirement where i need to do the following.
_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user
[Prev in Thread] | Current Thread | [Next in Thread] |