I have a Linux server that can be accessed through SSH.

I'm using the iOS shortcuts app to try and run scripts over SSH. If I try to do a Linux command like sudo apt-get install package, the shortcuts app returns no output from the server. However, if I run a command from my phone that doesn't require elevated permissions (like ifconfig), it does return the output.

I assume that when I try to run sudo commands from my phone via the shortcuts app, the reason nothing is being returned is because it requires the password (because those commands require elevated permissions), however the shortcut ends as soon as nothing is returned from the SSH server.

I've tested the same SSH server on different computers, and it all works fine, so I think it's something I need to add additionally for the shortcut on my iPhone to work.

So my question is - Is it possible to then enter the password fro a command like sudo apt-get, etc so then the script can continue to run as normal?

  • Interesting use case. Any reason you don’t make a script on the Linux side or add the command to sudoers so sudo runs unprompted? This might skip the need for a mute fully functioning shell app on iOS and simplify your efforts to automate.
    – bmike
    Oct 3, 2020 at 12:40
  • @bmike It was sort of just a matter of convenience for me. I'm not new to Linux (but wouldn't exactly call myself experienced either). I assume when I add a command to sudoers, there are some added security risks? Oct 3, 2020 at 21:37
  • 1
    For sure - passing a passphrase in plain text is risky, storing it in plain text is risky. I usually like to assume if someone has a password to enter for sudo - the added risk of granting them sudoers is low and worth the savings in hassle. Unless you are depending on the pause to prevent execution - that sort of "mistake" risk. If you're going to have a script execute it anyway - seems not to add much risk to me to go the sudoers route.
    – bmike
    Oct 3, 2020 at 21:51
  • @bmike Thanks! I'll probably do that then. It sounds like a good solution. Oct 3, 2020 at 21:55

1 Answer 1


No, you can't enter a password. The only thing that I can think of is adding the commands you want to be able to run to the sudoers file.

I'm not sure how to works in Linux but on macOS you put a file in /etc/sudoers.d/something using the visudo command.

There seems to be an example page for Linux here: https://phoenixnap.com/kb/linux-sudo-command that might be useful as a starting point.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .