9

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?

25
$ 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.

  • @Mark: look into the different pam authentication modules to add network authentication support (pam_krb5 and pam_ldap are a good place to start) – photoionized Apr 26 '11 at 18:44
  • ok, but when I try sudo -u [domain2]\[username] it tells me 'unknown user: [domain2][username]' – Mark J Miller Apr 26 '11 at 19:07
  • @Mark - that would be becuase by default, linux hosts know nothing of your AD/Windows environment. It's certainly possible to configure linux to use AD for authentication, but that's a separate question. – EEAA Apr 26 '11 at 19:10
  • you're right, I've awarded the points and I'll post a new question. – Mark J Miller Apr 26 '11 at 19:16
  • 2
    @Mark Sounds good. Before you post a new question, though, search through old ServerFault questions. There are scads of them relating to integration of linux and Windows. – EEAA Apr 26 '11 at 19:21
7

sudo or su

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.