Indice del forum
infoe4a.it - Il Forum NON UFFICIALE degli utenti e4a
 REGOLAMENTOREGOLAMENTO   FAQ  FAQ   Cerca  Cerca   Lista utenti  Lista utenti   Gruppi  Gruppi CHAT  CHAT   Phoogle Map  Phoogle Map
Registrati  ::  Log in Messaggi privati


Nuovo argomento  Rispondi
 sudo in windows? « Precedente :: Successivo » 
Autore Messaggio
Artic
MessaggioInviato: Ven Mag 01, 2009 11:56 am    Oggetto: sudo in windows? Rispondi citando




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 Mr. Green )

Grazie in anticipo hi
_________________
Linea 4096/512Kbps - 256Kbps mcr

Trew ha scritto:
hai rischiato otto ammonimenti e tre ban in un sol colpo Very Happy


<"sudo" vuol dire "diventa superman", ma superman a volte è di cattivo umore e rompe tutto> - F. Bombi
This post doesnot have score yet, be the first to comment:    
The copyright belongs to Artic and infoe4a.it - Il Forum NON UFFICIALE degli utenti e4a, no authorized actions like re-post are strictly prohibited.
Top
Profilo Invia messaggio privato Phoogle Map
Sponsor
karyal
MessaggioInviato: Ven Mag 01, 2009 1:21 pm    Oggetto: Rispondi citando

2° avvertimento
User is appraised 1.00 out of 5

Registrato: 06/01/07 22:24
Età: 35
Messaggi: 6963

http://www.google.it/search?q=esecuzione+comando+windows+con+diritti+amministratore&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:it:official&client=firefox-a

terzo risultato

http://www.dalberto.it/blog/2008/02/01/eseguire-un-programma-da-riga-di-comando-con-i-privilegi-di-amministratore-su-windows-vista/

Non mi assumo responsabilità... nota:

Citazione:

Il problema è che, a volte, capita di dover eseguire un programma (in particolare utility) con i diritti di amministratore. Fin qui, poco male.
Questo perché possiamo fare tasto destro sull'icona del programma stesso e eseguirlo come amministratore.

Ma se avessimo la necessità di eseguire un programma da riga di comando con i diritti di ammistratore?
Ufficialmente non è possibile.


Quindi direi che devi comunque usare qualcosa di esterno
This post doesnot have score yet, be the first to comment:    
The copyright belongs to karyal and infoe4a.it - Il Forum NON UFFICIALE degli utenti e4a, no authorized actions like re-post are strictly prohibited.
Top
Profilo Invia messaggio privato
r3lative
MessaggioInviato: Ven Mag 01, 2009 2:17 pm    Oggetto: Rispondi citando

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
This post doesnot have score yet, be the first to comment:    
The copyright belongs to r3lative and infoe4a.it - Il Forum NON UFFICIALE degli utenti e4a, no authorized actions like re-post are strictly prohibited.
Top
Profilo Invia messaggio privato Invia e-mail HomePage Phoogle Map
Artic
MessaggioInviato: Ven Mag 01, 2009 4:09 pm    Oggetto: Rispondi citando




Registrato: 23/06/07 18:46
Età: 20
Messaggi: 459
Residenza: Busiago

perfetto runas è quello che cercavo! grazie relative Very Happy

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... mmm
_________________
Linea 4096/512Kbps - 256Kbps mcr

Trew ha scritto:
hai rischiato otto ammonimenti e tre ban in un sol colpo Very Happy


<"sudo" vuol dire "diventa superman", ma superman a volte è di cattivo umore e rompe tutto> - F. Bombi
This post doesnot have score yet, be the first to comment:    
The copyright belongs to Artic and infoe4a.it - Il Forum NON UFFICIALE degli utenti e4a, no authorized actions like re-post are strictly prohibited.
Top
Profilo Invia messaggio privato Phoogle Map
r3lative
MessaggioInviato: Ven Mag 01, 2009 7:47 pm    Oggetto: Rispondi citando

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
This post doesnot have score yet, be the first to comment:    
The copyright belongs to r3lative and infoe4a.it - Il Forum NON UFFICIALE degli utenti e4a, no authorized actions like re-post are strictly prohibited.
Top
Profilo Invia messaggio privato Invia e-mail HomePage Phoogle Map
Mostra prima i messaggi di:   
Nuovo argomento  Rispondi Pagina 1 di 1

Vai a:  
Discussioni simili
Argomenti Autore Risposte Consultazioni Ultimo messaggio
Non ci sono nuovi messaggi windows wifi e http
simone_lago 15 546 Ven Lug 11, 2008 9:59 pm
dragon Leggi gli ultimi messaggi
Non ci sono nuovi messaggi Problema internet per colpa di un aggiornamento windows
pushup 9 357 Ven Lug 11, 2008 9:40 pm
marte_57 Leggi gli ultimi messaggi
Non ci sono nuovi messaggi Windows Vista e 4Gb RAM
DaveDevil 8 240 Sab Giu 28, 2008 7:47 pm
r3lative Leggi gli ultimi messaggi
Non ci sono nuovi messaggi FreeSpire. Linux come windows, ma meglio di windows.
simone_lago 26 774 Dom Ago 26, 2007 1:55 pm
andretta Leggi gli ultimi messaggi
Non ci sono nuovi messaggi [game] Windows HIV
Trew 0 297 Mer Feb 21, 2007 1:18 am
Trew Leggi gli ultimi messaggi



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


Powered by phpBB © 2001, 2005 phpBB Group