In un ambiente VM sandbox, ho una configurazione di Ubuntu Linux che è protetta da firewall e non è possibile accedervi dall'esterno del sistema locale. Pertanto, su quella VM, vorrei dare all'utente amministrativo (che ho configurato) la possibilità di eseguire qualsiasi cosa con sudo e non ha bisogno di una password.
Anche se so che questo non è sicuro, questa VM non è sempre attiva e richiede il mio passcode personale per essere eseguita. Quindi, anche se questo non è "sicuro", c'è un modo per ottenere la funzionalità desiderata?
Risposta accettata:
Da man sudoers:
NOPASSWD and PASSWD
By default, sudo requires that a user authenticate him or herself
before running a command. This behavior can be modified via the
NOPASSWD tag. Like a Runas_Spec, the NOPASSWD tag sets a default for
the commands that follow it in the Cmnd_Spec_List. Conversely, the
PASSWD tag can be used to reverse things. For example:
ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
would allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm
as root on the machine rushmore without authenticating himself.
Un altro tag è ALL
, per consentire all'utente ray di eseguire qualsiasi comando su qualsiasi host senza password puoi utilizzare:
ray ALL= NOPASSWD: ALL