running commands as other users - best method
        Posted  
        
            by 
                linuxrawkstar
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by linuxrawkstar
        
        
        
        Published on 2012-10-12T15:09:47Z
        Indexed on 
            2012/10/12
            15:39 UTC
        
        
        Read the original article
        Hit count: 234
        
linux
|command-line
When running commands as other users from the command line, what is recommended best practice?  In the past I've used sudo like so:
    sudo -u username command [args]
I've been told (with no specific reasons why) that using sudo for this purpose is wrong.  I'd like to know why.  Is there some "best way" to accomplish this?  For example, I've also used the su command like so:
    su username - -c "command [args]"
I can't imagine why either of these methods would be "bad". Your thoughts?
© Server Fault or respective owner