|
 |
|
| sudo in windows? |
« Precedente :: Successivo » |
| Autore |
Messaggio
|
| Artic |
Inviato: Ven Mag 01, 2009 11:56 am Oggetto: sudo in windows? |
|
|

Registrato: 23/06/07 18:46 Età: 20 Messaggi: 459 Residenza: Busiago
|
Esiste un comando da riga che permetta di eseguire un singolo programma/comando/script con diritti di amministratore?
Che sintassi ha?(perché quelle simil man-pages di win$ dicono davvero poco )
Grazie in anticipo  _________________ Linea 4096/512Kbps - 256Kbps mcr
| Trew ha scritto: | hai rischiato otto ammonimenti e tre ban in un sol colpo  |
<"sudo" vuol dire "diventa superman", ma superman a volte è di cattivo umore e rompe tutto> - F. Bombi |
|
| Top |
|
 |
Sponsor
|
|
 |
| karyal |
Inviato: Ven Mag 01, 2009 1:21 pm Oggetto: |
|
|
 2° avvertimento 
Registrato: 06/01/07 22:24 Età: 35 Messaggi: 6963
|
|
| Top |
|
 |
| r3lative |
Inviato: Ven Mag 01, 2009 2:17 pm Oggetto: |
|
|
 BANNATO
Registrato: 03/05/07 00:27
Messaggi: 7340 Residenza: Saccolongo - PD - ITALY - terzo pianeta a sinistra
|
io ho sempre fatto cosi ...
apro una finestra con i diritti di amministratore, e quindi quando lancio un comando, anche questo ha i diritti della cli aperta.
per aprirla, basta fare click dx sulla cli (menu, ecc) ed eseguirla come administrator
se invece vuoi eseguire solo un comando, devi usare la "runas"
Codice:
C:\Documents and Settings\Administrator>runas
UTILIZZO RUNAS:
RUNAS [ [/noprofile | /profile] [/env] [/savecred | /netonly] ]
/utente:<NomeUtente> programma
RUNAS [ [/noprofile | /profile] [/env] [/savecred] ]
/smartcard [/utente:<NomeUtente>] programma
/noprofile specifica che il profilo utente non deve essere caricato.
Ciò aumenta la velocità di caricamento
dell'applicazione, ma
alcune applicazioni potrebbero non
funzionare correttamente.
/profile specifica che deve essere caricato il profilo utente.
Questo è il valore predefinito.
/env per utilizzare l'ambiente corrente invece di
quello dell'utente.
/netonly se le credenziali specificate sono soltanto per
l'accesso remoto.
/savecred per utilizzare credenziali precedentemente
salvate dall'utente.
Questa opzione non è disponibile in Windows XP
Home Edition e verrà ignorata.
/smartcard utilizzare questa opzione se le credenziali devono
essere fornite da una smart card.
/utente <NomeUtente> nella forma UTENTE@DOMINIO o DOMINIO\UTENTE
program riga di comando per EXE. Vedere sotto gli esempi
Esempi:
> runas /noprofile /user:mymachine\administrator cmd
> runas /profile /env /utente:dominiolocale\admin "mmc %windir%\system32\dsa.msc
"
> runas /env /utente:utente@dominio.microsoft.com "notepad \"my file.txt\""
NOTA: immettere la password utente solo su richiesta.
NOTA: UTENTE@DOMINIO non è compatibile con /netonly.
NOTA: /profile non è compatibile con /netonly.
NOTA: /savecred non è compatibile con /smartcard.
_________________ “Mai argomentare con un idiota;
ti fa scendere al suo livello e ti batte per esperienza ”
r3lative blog |
|
| Top |
|
 |
| Artic |
Inviato: Ven Mag 01, 2009 4:09 pm Oggetto: |
|
|

Registrato: 23/06/07 18:46 Età: 20 Messaggi: 459 Residenza: Busiago
|
perfetto runas è quello che cercavo! grazie relative
Adesso però go un altro problema. mi riesce difficile redirezionare l'output del programma che eseguo sotto runas mi spiego:
se eseguo
Codice: runas /noprofile /utente:Admin " "netsh firewall show allowedprogram" > "C:\Documents and Settings\User\Documenti\log.txt" "
runas mi da errore perchè vuole un solo comando, mentre se sposto fuori il redirezionamento in questo mondo:
Codice: runas /noprofile /utente:Admin "netsh firewall show allowedprogram" > "C:\Documents and Settings\User\Documenti\log.txt"
giustamente mi scrive nel file solo "Inserire password"
L'unica soluzione che mi viene in mente è quella di far digerire a runas un intero batch...  _________________ Linea 4096/512Kbps - 256Kbps mcr
| Trew ha scritto: | hai rischiato otto ammonimenti e tre ban in un sol colpo  |
<"sudo" vuol dire "diventa superman", ma superman a volte è di cattivo umore e rompe tutto> - F. Bombi |
|
| Top |
|
 |
| r3lative |
Inviato: Ven Mag 01, 2009 7:47 pm Oggetto: |
|
|
 BANNATO
Registrato: 03/05/07 00:27
Messaggi: 7340 Residenza: Saccolongo - PD - ITALY - terzo pianeta a sinistra
|
mi ero dimenticato (lo uso mai) ...
scaricati i sysinternals tools (ora m$)
tra le varie cosine c'è il programma psexec
| Citazione: |
C:\Documents and Settings\Administrator>psexec
PsExec v1.94 - Execute processes remotely
Copyright (C) 2001-2008 Mark Russinovich
Sysinternals - www.sysinternals.com
PsExec executes a program on a remote system, where remotely executed console
applications execute interactively.
Usage: psexec [\\computer[,computer2[,...] | @file][-u user [-p psswd]][-n s][-l
][-s|-e][-x][-i [session]][-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,...
] cmd [arguments]
-a Separate processors on which the application can run with
commas where 1 is the lowest numbered CPU. For example,
to run the application on CPU 2 and CPU 4, enter:
"-a 2,4"
-c Copy the specified program to the remote system for
execution. If you omit this option the application
must be in the system path on the remote system.
-d Don't wait for process to terminate (non-interactive).
-e Does not load the specified account's profile.
-f Copy the specified program even if the file already
exists on the remote system.
-i Run the program so that it interacts with the desktop of the
specified session on the remote system. If no session is
specified the process runs in the console session.
-l Run process as limited user (strips the Administrators group
and allows only privileges assigned to the Users group).
On Windows Vista the process runs with Low Integrity.
-n Specifies timeout in seconds connecting to remote computers.
-p Specifies optional password for user name. If you omit this
you will be prompted to enter a hidden password.
-s Run the remote process in the System account.
-u Specifies optional user name for login to remote
computer.
-v Copy the specified file only if it has a higher version number
or is newer on than the one on the remote system.
-w Set the working directory of the process (relative to
remote computer).
-x Display the UI on the Winlogon secure desktop (local system
only).
-priority Specifies -low, -belownormal, -abovenormal, -high or
-realtime to run the process at a different priority. Use
-background to run at low memory and I/O priority on Vista.
computer Direct PsExec to run the application on the remote
computer or computers specified. If you omit the computer
name PsExec runs the application on the local system,
and if you specify a wildcard (\\*), PsExec runs the
command on all computers in the current domain.
@file PsExec will execute the command on each of the computers listed
in the file.
program Name of application to execute.
arguments Arguments to pass (note that file paths must be
absolute paths on the target system).
You can enclose applications that have spaces in their name with
quotation marks e.g. psexec \\marklap "c:\long name app.exe".
Input is only passed to the remote system when you press the enter
key, and typing Ctrl-C terminates the remote process.
If you omit a user name the process will run in the context of your
account on the remote system, but will not have access to network
resources (because it is impersonating). Specify a valid user name
in the Domain\User syntax if the remote process requires access
to network resources or to run in a different account. Note that
the password is transmitted in clear text to the remote system.
Error codes returned by PsExec are specific to the applications you
execute, not PsExec.
C:\Documents and Settings\Administrator>
|
i sysinternals tools sono le cose che tutti dovrebbero avere nel loro pc. ma proprio tutti. _________________ “Mai argomentare con un idiota;
ti fa scendere al suo livello e ti batte per esperienza ”
r3lative blog |
|
| Top |
|
 |
|
|
|
 |
|
Pagina 1 di 1 |
|
Non puoi inserire nuovi argomenti Non puoi rispondere a nessun argomento Non puoi modificare i tuoi messaggi Non puoi cancellare i tuoi messaggi Non puoi votare nei sondaggi
|
|
|
|