• Uncategorized

About linux : try-to-write-python-code-to-execute-linux-command-as-different-users-in-same-machine

Question Detail

I am trying to write python code which will login as different users one by one and try to fetch permission for different directories for logged users one by one.

import os
import subprocess
cmd='echo "testuser" | sudo -S su - {o} -c "{1}"'.format(user_name,method_name(args))
(status, output)=subprocess.getstatusoutput(cmd)

Question Answer

No answer for now.

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.