python - Switching user in Fabric using with settings(user='user') -
i'm trying switch user in fabric:
def check_user(): settings(user='linevich'): run("whoami")
result:
[root@127.0.0.1:10022] executing task 'check_user' [root@127.0.0.1:10022] run: whoami [root@127.0.0.1:10022] login password 'linevich': [root@127.0.0.1:10022] out: root
what's wrong?
(no, don't want use sudo()
instead.)
solution: used following command launch script:
fab -h root@127.0.0.1:10022
right way - run without setting username:
fab -h 127.0.0.1:10022
Comments
Post a Comment