How can I run something as Administrator via Cygwin's SSH?

25,861

If you log in to sshd with password authentication, then you authenticate simultaneously to Windows and should be granted your account's administrative rights. If you log in with public key authentication, then sshd makes an end run around Windows authentication, and you'll only ever have standard user rights.

For more information, see Corinna's answer to this question from 2004. See also the recent thread on the Cygwin mailing list about admin rights over ssh.

Share:
25,861

Related videos on Youtube

user3386503
Author by

user3386503

Updated on September 17, 2022

Comments

  • user3386503
    user3386503 over 1 year

    I'm trying to connect to a remote Windows 7 box that needs a setup change or two. I've got access to an Administrator account via Cygwin's SSH server, but Cygwin won't let me run Administrator-privilege utilities ("The requested operation requires elevation (Run as administrator.)")

    The standard solution for this is, to the best of my knowledge, RunAs.exe, but trying to run it via SSH results in it quitting instantly with no diagnostic (even when run as "runas /?"). Starting "cmd" from ssh gives me a standard DOS prompt, but from the DOS prompt, "runas" just echoes the commandline back at me no matter what I do, again, even when run as "runas /?".

    Cygwin won't let me connect as Administrator@computername.

    Any suggestions?

    • user73139
      user73139 about 13 years
      bump I'd like to know the answer to this too.
  • user3386503
    user3386503 over 11 years
    Doesn't work when coming in from the outside - that's why the whole "SSH" thing is important.
  • HikeMike
    HikeMike almost 11 years
    Have you tried whether this works in Cygwin?
  • AdishRao
    AdishRao about 8 years
    the important point of the OP's question is the remote part: cygstart --action=runas only hangs and does show any credential window via the ssh connection (how could it?)
  • CHarris
    CHarris over 7 years
    This answer worked for me, upvoted.
  • C Fraire
    C Fraire about 7 years
    It's maddening that you get administrative rights with public key authentication with workgroup workstations (Windows 10) but not for Domain-connected servers (Windows Server 2012).