diff options
author | Ron Yorston <rmy@pobox.com> | 2019-03-07 14:54:41 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-03-07 15:34:24 +0000 |
commit | 0533794afd81b37684669ee0c5afc7a5e1ff159d (patch) | |
tree | a6afcd3e6c5e6430093b5e01111d799ed1a30622 /shell | |
parent | 585d17d262efabce4a9a87f33f531ef9ab7c0e36 (diff) | |
download | busybox-w32-0533794afd81b37684669ee0c5afc7a5e1ff159d.tar.gz busybox-w32-0533794afd81b37684669ee0c5afc7a5e1ff159d.tar.bz2 busybox-w32-0533794afd81b37684669ee0c5afc7a5e1ff159d.zip |
su: add a basic implementation for WIN32
Use the undocumented 'runas' verb in a call to ShellExecuteEx()
to run a shell with elevated privileges.
Because of the way ShellExecuteEx() works this:
- requires that you acknowledge a User Account Control prompt (if
you're an Administrator);
- requires that you enter an Administrator's password (if you aren't
an Administrator);
- creates a separate console window for the privileged shell.
Variables from the parent shell aren't passed to its privileged child,
only variables from the environment.
It's possible to specify a command to run when the shell starts.
This can be used to pass shell variables:
su -c "HELLO='hello world'; GOODBYE=$GOODBYE"
Or do fancy things like:
su -c "ls -l; read -p 'Hit return to exit: '; exit"
It's probably best to put double quotes around the command and use
single quotes inside it. Apparently ShellExecuteEx() requires
double quotes to be entered in triplicate:
su -c 'HELLO="""hello world"""'
Diffstat (limited to 'shell')
0 files changed, 0 insertions, 0 deletions