{"id":1267,"date":"2012-11-16T15:14:40","date_gmt":"2012-11-16T13:14:40","guid":{"rendered":"http:\/\/blog.sfsoft.it\/?p=1267"},"modified":"2012-11-16T15:14:40","modified_gmt":"2012-11-16T13:14:40","slug":"eseguire-il-run-as-administrator-senza-fornire-la-password-su-windows","status":"publish","type":"post","link":"http:\/\/www.sfsoft.it\/blog\/2012\/11\/16\/eseguire-il-run-as-administrator-senza-fornire-la-password-su-windows\/","title":{"rendered":"Eseguire il &#8220;run as Administrator&#8221; senza fornire la password su Windows"},"content":{"rendered":"<p>Una necessit\u00e0 che si presenta in alcune circostanze \u00e8 quella di dare la possibilit\u00e0 ad utenti con permessi limitati di eseguire determinati comandi che richiedano diritti amministrativi senza fornirgli le credenziali.<\/p>\n<p>Ad esempio poter eseguire il classico &#8220;run as Administrator&#8221; senza che l&#8217;utente sia a conoscenza dei dati di accesso e senza richiedere la presenza dell&#8217;amministratore.<\/p>\n<p>Un programma che viene in soccorso si chiama <a href=\"http:\/\/www.joeware.net\/freetools\/tools\/cpau\/index.htm\" target=\"_blank\">CPAU<\/a>, che ha la possibilit\u00e0 di preparare un file di lavoro ove verranno salvate le credenziali di accesso in maniera cifrata in maniera poi che l&#8217;utente con diritti limitati possa eseguire ugualmente il comando.<\/p>\n<p>Un esempio di utilizzo \u00e8 il seguente:<\/p>\n<pre parse=\"no\">CPAU.exe -u &lt;nomedominio\\nomeutente&gt; -p &lt;password&gt; -ex &lt;comando&gt; -enc -file &lt;nomefile&gt;<\/pre>\n<p>Una volta generato il file \u00e8 possibile farlo eseguire in questa maniera:<\/p>\n<pre parse=\"no\">CPAU.exe -dec -file &lt;nomefile&gt; -lwp<\/pre>\n<p>Per avere la lista completa delle opzioni \u00e8 possibile richiamarle mediante il comando &#8220;CPAU.exe \/?&#8221;, per completezza le riporto qui di seguito:<\/p>\n<pre parse=\"no\">CPAU V01.11.00cpp Joe Richards (joe@joeware.net) November 2005\r\n\r\nUsage:\r\n CPAU -u user [-p password] -ex \"WhatToRun\" [switches]\r\n\r\n   user       User to log on as. Ex: user or domain\\user\r\n   password   User's password\r\n   WhatToRun  What to execute\r\n\r\n  Switches: (designated by - or \/)\r\n   -profile   Do local logon with profile instead of net logon\r\n   -localwithprofile Alias for -profile\r\n   -lwp       Alias for -profile\r\n   -localwithoutprofile  Local logon but do not load profile.\r\n   -lwop      Alias for -localwithoutprofile\r\n   -k         Prefix command with cmd \/k to leave window open\r\n   -c         Prefix command with cmd \/c to close window after exec.\r\n   -pipepwd   Special method allows you to pipe password in\r\n   -enc       Encrypt a job file for later user\r\n   -dec       Use an ecrypted job file\r\n   -file      Specify job file to execute or create\r\n   -wait      Wait for process completion before returning.\r\n   -outprocexit Used with -wait, the errorlevel variable has the\r\n              exit code of the spawned process instead of cpau.\r\n   -cwd x     Start at working directory x.\r\n   -hide      Start the new process in a hidden state.\r\n   -title x   Allow you specify title of command prompt windows.\r\n   -crc file[,file,file]   This option allows you to encode\r\n              CRC info for files in the job file. When decoded\r\n              the CRC have to match or the program bombs. Note that\r\n              it will not chase paths looking for the file, you must\r\n              specify the exact path.\r\n   -nowarn    Don't output warning about network logon.\r\n\r\n  Ex1:\r\n    cpau -u joehome\\joe -p logon -ex \"perl cleanup.pl\" -lwp\r\n      Runs perl script cleanup.pl as joehomejoe\r\n\r\n  Ex2:\r\n    cpau -u joehome\\joe -p logon -ex \"perl cleanup.pl\" -enc -file cleanup.job\r\n      Creates job file called cleanup.job to run perl script cleanup.pl as joehomejoe\r\n\r\n  Ex3:\r\n    cpau -dec -file cleanup.job -lwp\r\n      Execute job file cleanup.job\r\n\r\n  Ex4:\r\n    cpau -u joehome\\joe -p logon -ex \"perl cleanup.pl\" -wait -lwp\r\n      Runs perl script cleanup.pl as joehomejoe and waits for process to end\r\n\r\n  Ex5:\r\n    cpau -u joe -p logon -ex notepad.exe -lwp\r\n      Runs notepad as user joe\r\n\r\n  Ex6:\r\n    cpau -u joehome\\joe -p logon -ex logonscript.cmd -lwp\r\n      Runs logon script in current directory as user joe (see note below)\r\n\r\n  Ex7:\r\n    cpau -u joehome\\joe -p logon -ex logonscript.cmd -lwp -cwd c:\\temp\r\n      Runs logon script in\/from c:\\temp as user joe (see note below)\r\n\r\n  Ex8:\r\n    cpau -u joe -p logon -ex logonscript.cmd -enc -file logon.job -crc logonscript.cmd\r\n      Encodes logon.job file and CRC protects the batch file<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Una necessit\u00e0 che si presenta in alcune circostanze \u00e8 quella di dare la possibilit\u00e0 ad utenti con permessi limitati di eseguire determinati comandi che richiedano diritti amministrativi senza fornirgli le credenziali. Ad esempio poter eseguire il classico &#8220;run as Administrator&#8221; senza che l&#8217;utente sia a conoscenza dei dati di accesso e senza richiedere la presenza [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[15,138,31],"tags":[16,142,35],"_links":{"self":[{"href":"http:\/\/www.sfsoft.it\/blog\/wp-json\/wp\/v2\/posts\/1267"}],"collection":[{"href":"http:\/\/www.sfsoft.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sfsoft.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sfsoft.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sfsoft.it\/blog\/wp-json\/wp\/v2\/comments?post=1267"}],"version-history":[{"count":1,"href":"http:\/\/www.sfsoft.it\/blog\/wp-json\/wp\/v2\/posts\/1267\/revisions"}],"predecessor-version":[{"id":1268,"href":"http:\/\/www.sfsoft.it\/blog\/wp-json\/wp\/v2\/posts\/1267\/revisions\/1268"}],"wp:attachment":[{"href":"http:\/\/www.sfsoft.it\/blog\/wp-json\/wp\/v2\/media?parent=1267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sfsoft.it\/blog\/wp-json\/wp\/v2\/categories?post=1267"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sfsoft.it\/blog\/wp-json\/wp\/v2\/tags?post=1267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}