1

I want to execute a Shell Command in my Swift Application. I read that i can't use NSTask, because there is no built in SSH in the iPhone. Now my question is how i can implement this without NSTask.

1
  • I've heard some good things about libssh-2-for-iOS but haven't had the occasion to try it out myself. Commented Feb 5, 2016 at 20:15

2 Answers 2

1

Instead of creating your own app you may want to look into an iOS app called 'Workflow'. It includes a module called 'Run Script Over SSH' which does exactly what the title states.

Sign up to request clarification or add additional context in comments.

Comments

0

Any use of API that forks and spawns a new process is disallowed by the App Store rules, so if you want to do this for an app you plan to submit, the short answer is that you can't.

NSTask and the exec*(3) family of C library functions certainly exist on iOS, but they aren't public API.

If you need SSH functionality, you need to find a library that provides that functionality to pass App Store review.

3 Comments

I dont want to submit the App to the App Store. I just want a App for me personally that starts and stops a Service that runs on my local Server.
Two options, then: 1. Use an SSH client library to make the connection. 2. Jailbreak your phone, install an SSH client (if one isn't installed for you), and use NSTask or exec*(3).
can you recommand a ssh library? i'd like to avoid jailbreaking my phone

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.