Applescript "with administrator privileges" and without Password prompt

i,
I have to configure some phone settings in the central VOIP/VPN/Gateway Router via a ssh (with certificate) command.
There is only a option to allow or disallow the ssh access in the router. Therefor I wrote a applescript to allow only the specific ssh command "set /Setup/Voice-Call-Manager/Call-Router/Call-Routing/". To avoid the configuration access for anyone and to hard code passwords I have to execute this script with root permissions (do shell script "/usr/bin/su - " & user & " -c " & "'" & cmd & "'" with administrator privileges"). In any other unix implementation I can use "chmod 4755; chown 0:0". Even I compiled the Applescript and stored it as Carbon App, I get a user/password prompt.
How can I avoid this prompt or authorize the script/app in any way?
Thanks Henri

I agree, but to use the private key of the applescript caller opens any user the ability to change any WLAN key, VPN settings or delete the admin account, not a good idea....
Therefor I would like to run the applescript with root, "su - <adminuser> ssh router set ....".
This restricts the access to the router config to this applescript and I would like avoid the hard coding of the root password in the applescript.
I tried also the add the command to /etc/sudoers, this work fine from the command line but how to call "sudo applescript" from the desktop without entering the admin password?
Thanks
Henri

Similar Messages

  • With Administrator Privileges Error:  Authentication Failed

    i have an applescript app with the following line:
    do shell script "/System/Library/StartupItems/CiscoTUN/CiscoTUN restart" with administrator privileges
    When I run this script in Script Editor, I'm prompted for the admin username/password, but when I run the script saved as an application, i receive:
    "Authentication failed."
    I've tried this script with and without "sudo" preceding the rest of the shell script, but it behaves the same either way.
    Any clue why "with administrator privileges" is working in Script Editor but not when the application is run alone? Thanks!

    Hello
    My wild shot in the dark.
    If you have not saved your script as application bundle, try saving it as such.
    Applet as application bundle contains universal binary while applet as (non-bundle) application contains ppc binary, which is run via Rosetta in x86mac.
    This might make difference.
    H

  • Access Denied when trying to access shared folders on the server with administrative privileges

    I have problem accessing shared folder on the server machine from Windows 7 machine even if I try to access it with administrative privileges (server Administrator account). I will try now to explain better my situation.
    In my company, we have small network infrastructure with one main server machine (HP ProLiant server) with Windows Server 2012 R2 installed and couple of desktop machines. The network is administrated by me.
    On Windows Server we have installed and setup DHCP, DNS, Remote Access and Routing, File and Storage and Active Directory services. Desktop machines are having Windows 8.1 Pro, Windows 8.1 or Windows 7 Home Premium installed on them. In Active
    Directory I have created domain, User groups and Users for employees in my company and so far, I didn't added desktop machines to the domain.
    Also, I've created one folder on the server which should contain different projects data for network users and I have set access permissions and security for this folder and shared it on the network (I've added couple of users to one user group and I
    gave Full control to this group over this folder). When I try to access this folder from network, I've been asked for login credentials (normally), where I just type in one of users username and password who has been given access permissions to (who is member
    of group with full control over the folder). From Windows 8.1 Pro and Windows 8.1 machines I can access and work on this folder without any problems.
    The problem comes with Windows 7 machines. On Windows 7 machines (I have also tried this with Windows 7 Ultimate in VMWare) I can access server, I can see its shares, but as soon I try to access folder I've created for projects, I get Access Denied message
    with request for User login credentials. Whichever user account I use (even servers main Administrator account) I keep getting this message over and over and I'm unable to access it at all.
    I have also tried to access the server through VPN (from local or outside) but I'm getting the same error again. Also I've tried to add these Windows 7 machines to the domain and login with domain user but the result is the same. Turned off both firewalls
    (on server and desktop machines, which I know is unnecessary, but lets try it), still same case. I've tried couple more things with registry editor on desktop machines which I found on different forums and websites but still no luck. And now I don't know
    what else I can do.
    Does anyone knows what's the problem here, have I set something wrong, have not set something I should?

    Hi MeipoXu,
    thanks for your response. I will first answer on your question.
    Yes, the main issue is that we can see the folder when we access the server but we cannot access its contents from Windows 7 machines. I have tried on two machines, one with Windows 7 Home Premium version and the other one with Windows 7 Ultimate version
    and the situation is the same.
    As you recommended, I've checked Network Discovery and File and Printer Sharing and the situation is next: File and Printer Sharing is turned on all layers (Private, Public and Domain) while Network Discovery is off for all layers too. I don't know if this
    is normal thing but Network Discovery cannot be turned on in Windows Server (I'm able to select Turn on Network Discovery and apply the changes, but when I get back to this settings page, I again see that it's turned off, so I assume this can't be changed
    at all).
    I also tried with icacls in command prompt and everything seems to be ok there regarding permissions. Share permissions are set to Full control to Everyone and Security permissions are set to Full control only for Administrators and the user group I've created
    for employees in my company. The confirmation for this is that on Windows 8 machines you can access this folder without any problem and without getting any message connected with access permissions with any user account within this user group. This share is
    created through File and Storage Services service in Server Manager panel.
    And then something came up on my mind. I went in Server Manager to check shared folder settings in File and Storage Services and under Settings page I saw that "Encrypt data access" has been enabled (I enabled this option because I thought
    I will get more security with this option). I asked my self what would happen if I disable it, tried it and now everything works ok on Windows 7 machines too. Now I assume that Windows 7 doesn't have this feature implemented or there are some
    settings which needs to be set on Windows 7 machines to make this encryption thing work with Windows Server. So basically, I will let this feature off for now until I find out more about it and how to implement it to work with all operating systems.
    I want to thank you once more for your kind help!

  • My 'run with administrative privileges' script no longer works - help

    Hey all. I have an applescript that shuts down the computer that I made a while back. I pulled it out today to use it and it no longer works. Here's part of the code I'm having trouble with:
    do shell script ¬
    "sudo shutdown -h now" password "myadminpassword" with administrator privileges
    On old machines this worked great, I would just put the admin password where myadminpassword is and it would work perfectly. Now though, I run it on my machine and I get the prompt to enter my admin username and password before it will shutdown.
    Now this is going on a remote install so I need it to work. Any ideas? The machine is running snow leopard, but it seems to still work on an old leopard macbook pro.

    Well, for one, do not use sudo in do shell script.
    The whole 'with administrator privileges' part takes care of elevating your privileges. sudo has no place in do shell script.
    Don't know if that's your issue, but it's the first thing I'd fix.
    If that doesn't help, are you running the script as your admin user?
    Nowhere in your script are you defining the username to run the command as, therefore it will attempt to run as the current user who may not be the same as your admin user, nor have the same password. You might need to include the username:
    do shell script "shutdown -h now" user name "admin" password "myadminpassword" with administrator privileges

  • Open application with administrative privilege

    Can anyone point me to resources on how to execute a command in Java to open an application with administrative privileges - similar to the windows runas command - but will accept the login and password in the command?

    First figure out how to do it at the command line (it's beyond me). Then use Runtime.exec() to run the command. You'll have to use the Process's output stream to respond to the password prompt, and it's possible that might not work if Windows isn't prompting on stdin.

  • Error inserting image file in Excel 2013, it's working with administrator privileges

    When I tri to insert image file like .JPG in Excel 2013, I get an import error. It's working fine with administrator privileges.
    I check, graphic filter (registry values)  and made also an Office repare. But i have still the problem.
    My computer: Windows 8.1 64 bits, Office 2013 32 bits

    Try to check the grant permission for the Excel property itself.
    Try to insert image from other path, e.g. D:\ to check if we still receive the error.
    Try to run Excel with safe mode. ("Excel.exe /safe") and perform th insert action without any add-ins interrupt. Thanks.
    Tony Chen
    TechNet Community Support

  • Do Shell Script .. with Administrator Privileges ... ?

    hi everyone!
    I have a script that have multiple lines like this:
    do shell script " ... " with administrator privileges
    do shell script " ... " with administrator privileges
    Mac OS X 10.4 does it right(?) by asking ONCE for an admin login/password, and would run both lines above ... but 10.2 (and 10.3?) asks TWICE for the password using the same code. What am I doing wrong? I want all versions 10.2-4 to ask only once ... Any ideas?
    Thank you!!
    Cass

    If you would prefer that your script would not ask for a password to get admin privileges, then this uses the keychain:
    set aVariable to do shell script DefinedAsVariable password getPassw() with administrator privileges
    -- The Handler --
    The following handler assumes you have a password in your keychain called ASPW (could be anything you want) saved as a generic key. To do that, open your Keychain Access (in Utilities) application, choose file New, and in the sheet give it a name, enter your account name and type the password you want to use (your admin password in this case). OK. Now find the new password and double-click it. Under the attributes tab change Kind to generic key (it will be Applications). This makes for a fast search because there aren't many of them. Switch to the access control tab and select the "Allow all applications to access this item" button. Enter your admin password in the dialog that appears, and you are done. The first time you run the script, you'll have to click "Always Allow" in the dialog that appears - perhaps several times. After that, it won't ask.
    to getPassw()
    tell application "Keychain Scripting"
    launch
    tell current keychain to ¬
    tell (some generic key whose name is "ASPW")
    return password
    end tell
    end tell
    end getPassw

  • How to connect an apple tv to an enterprise network with a username and a password?   I need to use it over my university's wifi. theres no option to enter username and password. how to connect the apple tv to such enterprise network?

    How to connect an apple tv to an enterprise network with a username and a password?
    I need to use it over my university's wifi. theres no option to enter username and password. how to connect the apple tv to such enterprise network?

    Contact the University's IT dept, they may be able to set something up on the network to allow the ATV to connect without the need for a user name/password.

  • If I no longer have access to my original e-mail associated with my account and my passwords and e-mail accounts associated with my Apple device, how can I fix this solution? I have 2 ipads and 1 iphone and I cannot update any of my apps.

    I tried to change the e-mail associated with my apple account because my school was closing and I knew I would no longer have accss to that e-mail account, however now all 3 of my devices ( 2 ipads & 1 iphone are screwed up as far as the e-mail accounts associated with each device and the passwords. I have tried all the on-line support/suggestions and took my devices to a local Apple store and no one/nothing helps.
    Does anyone have a solution? I can purchase new apps but I cannot update any of the apps I have to any of my devices.
    <Email Edited By Host>

    Unfortunately, it says I can't delete anything without the missing password.

  • Blackberry Media Sync Failed To Initialize - Run With Administrative Privileges

    I've downloaded the Blackberry Desktop Manager (4.7) and everything works fine except for the Blackberry Media Sync which fails to initialize and needs to be run with administrative privileges.  Anyone experience this and how did you correct the administrative privileges situation.  I am using a BB Bold.  TYIA

    BlackBerry Media Sync has just been updated to version 2.0.
    I suggest you download it and see if the issue is solved.
    The search box on top-right of this page is your true friend, and the public Knowledge Base too:

  • How do we open folders with administrator privileges?

    I am trying to open the folder Documents and Settings on my local machine.  I am the administrator, the computer is not on a network, and it is a standalone machine.

    Hello Milo,
    Thanks for the reply, I was just able to try your response today for the first time.
    I will type in exactly what I put in the command line
    icacls "D:\saved shit\" /grant administrators:F
    D:\saved shit" /grant administrators:F: The filename, directory name, or volume label syntax is incorrect.
    Successfully processed 0 files; Failed processing 1 files
    After this I enabled the "hidden admin" account and logged on that account to find I was able to edit the folder's permissions and I can now go into that folder.  The problem remains though that every folder and file within D:\saved shit is now inaccessible
    to either the administrator account or my original account with administrator privileges.
    When I attempt the icacls solution you posted for the subfolder D:\saved shit\My Documents it gives me the same message I wrote earlier.
    Sorry for the wall of text and I really do appreciate your help.  My end goal is just to have the default permissions set for all the files and subfolders so I can access them again.
    Thank you for your time!

  • Material cost estimate with quantity structure and without quantity structu

    What is the difference between material cost estiame with quantity strucutre and without quantiry structure?

    For the quantity structure pl read the following link
    http://help.sap.com/erp2005_ehp_02/helpdata/en/7e/cb938143a311d189ee0000e81ddfac/frameset.htm
    For without quantity stucture
    http://help.sap.com/erp2005_ehp_02/helpdata/en/7e/cb938143a311d189ee0000e81ddfac/frameset.htm

  • With my email and my password on iCloud I can unlock any Iphone?

    with my email and my password on iCloud I can unlock any Iphone?

    Sign out, then sign back in with the new ID.

  • I have windows vista user account with administrator privilege. I am unable to update mozilla firefox to the latest version. It is saying "do not have required privileges". I already uninstalled the previous version :(

    I am unable to update mozilla firefox. I have user account with administrator privilege.

    Try to run the installer as Administrator via the right-click context menu (Run as Administrator).

  • Hello, I have a problem with my iphone 4 battery, it looses 20% over the night with wifi on and without receiving any phone call or notification. It also uses 1 or 2% each time I check my iphone even if it is just to check up my messages. Is it normal?

    Hello, I have a problem with my iphone 4 battery, it looses 20% over the night with wifi on and without receiving any phone call or notification. It also uses 1 or 2% each time I check my iphone even if it is just to check up my messages. Is it normal? Please someone give me a solution

    Yes this is fairly normal. When you have wifi on the phone, it drains the battery life of the device.
    Here is an article that has some tips that you can follow so you can modify the settings on your device to extend it's battery life to the fullest.
    http://www.apple.com/batteries/iphone.html

Maybe you are looking for

  • Win 7 64bit drivers

    Dear Creative, When will Windows 7 64bit drivers be released for the X-Fi XtremeGamer Fatalty Pro Series? This card could do all sorts of things when I bought it, and now it can do nothing my old '92 soundblaster couldnt do. The front page of www.sou

  • Clearing of foreign vendors

    Dear all, We have certain foreign vendors for which transaction  is already completed.Balance is laying zero in their accounts.Now when we are clearing those  open items the system takes  the exchange rate of  current date. In which we are not able t

  • Future of Business Packages

    Hi, I was wondering if somebody knows or can give an opinion about how the future of the business packages (such as ESS) looks like? I see that there are still some updates of it with support packages. If there is a future for it then I like to know

  • For loop syn

    can an body pls. tell me is it correct syntex to use for loop for double value intilazation, double operation..i mean..see like this.. facing complation error... for(i=0 , j=b-1;i<a , j>-1;i++ , j--)           }

  • Support for Blackberry?

    Does anyone know whether OCFO 10 provides improved support for Blackberry Desktop Manager? The previous version only supported up to version 3.6 (without SP1 or SP2). Thank you.