FAQ
overflow

Great Answers to
Questions About Everything

QUESTION

my company has multiple domains and I log into my local machine with one set of credentials, but often when accessing certain network resources I need to use a different set of credentials. In Windows I would use RunAs where I have the option to run the entire process as under a different set of credentials or I could tell it to only impersonate the other user over the network (runas /netonly).

Is there something like this in Linux?

{ asked by Mark J Miller }

ANSWER

$ sudo -u <username> <command>

That will run the specified command as the user specified. It's not an exact drop-in for Windows' RunAs function, though, as that incorporates Kerberos authentication as well as for tasks that connect to remote hosts.

{ answered by ErikA }
Tweet