clarkgrubb / hyperpolyglot

hyperpolyglot.org
Other
473 stars 94 forks source link

RunAs for POSIX Shell, CMD.exe, PowerShell #81

Open 7fe opened 7 years ago

7fe commented 7 years ago

ubuntu both GUI and non GUI

echo "password " | sudo -H -u otheruser bash -c 'echo "I am $USER, with uid $UID"' 

Windows

runas /profile /user:test CMD "C:\Users\MyName\Desktop\Run.bat"

Mac the trickest one you need an additional script I think https://superuser.com/questions/188826/run-applications-as-another-user-in-mac-os-x