bypass warning with do shell script sudo

is there a way to bypass the warning causing an applescript error when initiating shell scripts with an admin paswword ?

whith a script featuring this :

do shell script “sudo my_command” password my_pass with administrator privileges

i got a warning message (the one that sometimes pop in the Terminal) :

#1 respect privacy etc…
#2 Think before you type etc…

I beleive that warning only occurs on the first attempt to use ‘sudo’, unless you are issuing the ‘sudo’ command with the 'K" flag, which removes the user’s timestamp entirely.

Yes i’m using sudo -K as well for user’s security but even if i would not have to use it there will still be a warning as you mention it, which is pretty disturbing cause it pops an applescript error… how getting rid of it ???

now i came across another weird thing, when trying to get the password from a text field, the returned value is blank but the same nib was fully working yesterday (the pass variable was returning the right user’s input password), so i guess i changed something without noticing it but that’s pretty weird as the only thing i changed was to switch the text field to NSSecureTextField in IB…

You can use ‘sudo -k’, that’s a lowercase “k”. This is from the manual (man sudo)…

       -k  The -k (kill) option to sudo invalidates the user's timestamp by
           setting the time on it to the epoch.  The next time sudo is run a
           password will be required.  This option does not require a password
           and was added to allow a user to revoke sudo permissions from a
           .logout file.

       -K  The -K (sure kill) option to sudo removes the user's timestamp
           entirely.  Likewise, this option does not require a password.

sure i can do this and i can do that but that will not lead me anywhere cause the Terminal privacy message still pop an applescript error on first log

It is possible to suppress the sudo warning, but i don’t recall exactly how off-hand (all i know is that i’ve done it). I think it might be a flag in the sudoers file. Do a man sudoers from the terminal. Hope this is helpful.

I think it might be as simple as adding this line to /etc/sudoers:

Defaults !lecture