Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 616029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:16:59+00:00 2026-05-13T18:16:59+00:00

Given that there is a file called copystuff in the Resources folder in a

  • 0

Given that there is a file called copystuff in the Resources folder in a an xCode project, and that file reads:

#!/bin/sh
cp -R /Users/someuser/Documents /Users/admin/Desktop

And if this bit of code below is linked to a button in IB … it will copy the /Users/someuser/Documents directory to /Users/admin when the button is pressed in a Cocoa app… It works when app is launched in an admin account ( using OS X 10.5.x here) …

NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/bin/sh"];
[task setArguments:[NSArray arrayWithObjects:[[NSBundle mainBundle]
pathForResource:@"copystuff" ofType:@"sh"], nil]];
[task launch];

My question is.. is there a way to have NSTask run a script running as root while this code is called from a non-admin account? Or asked another way..can Objective-C be coded to run scripts from say /usr/bin as root from a non-admin account?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:17:00+00:00Added an answer on May 13, 2026 at 6:17 pm

    I would strongly recommend against using an external script like this. It’s much better to do this with NSFileManager and keep this inside of controlled code. But to the question of how to become root, you want to look at Authorization Services. This site will walk you through how to create an application that escalates its privileges, including the appropriate UI elements for it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to read a locked file across a network given that
Given that I have a zip file called archive.zip that contains a file called
Given that there are many sizes and color depths for different phones (even for
This is not a technical question, but given that there are a few iPhone
What alternatives are there to GAE, given that I already have a good bit
Is there an easy way to verify that a given private key matches a
Is there any possibility that GetPropInfo returns nil even if the given class is
Is there a built-in function/method that can check if a given string is a
I have this layout file called menuAdmin. I wish to, each time a given
I thought that there was some way in .net 3.0 to give an array

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.