User Tag List

  1. hillie's Avatar
    I installed Tapp from and come up with a couple scripts to turn on/off sshd, so that you can only have it running when you need to get into the phone remotely.

    I know UIctl starts and stops all services but messing around in there can brick the phone, requiring a restore, and if you're one of those ppl who does not like to password-lock your phone, this is for you. This allows you to one-tap start or stop sshd using launchctl.


    rm -f .tmp
    launchctl load -w /Library/LaunchDaemons/com.openssh.sshd.plist > .tmp 2>&1

    t=`cat .tmp`

    if [ -z "$t" ]; then
    echo "sshd started successfully."
    echo "sshd could not be started:"
    cat .tmp

    rm -f .tmp
    launchctl unload -w /Library/LaunchDaemons/com.openssh.sshd.plist > .tmp 2>&1

    t=`cat .tmp`

    if [ -z "$t" ]; then
    echo "sshd successfully stopped."
    echo "sshd could not be stopped:"
    cat .tmp
    The reason I redirect everything into .tmp is (and this took me a while to figure out) it seems the ppl who wrote launchctl did not make use of return codes .. so you can't just do if launchctl ....; then do blabla; else blabla; fi because launchctl returns true no matter what happens.

    Fortunately, launchctl doesn't tell you jack **** if all went well, so if you have any output at all it basically had some kind of error and apparently Tapp either redirects stderr to /dev/null, or just straight up absorbs it.. i haven't seen the source... but yeah.. so unless you redirect staerr to a file and cat it out, you won't see it in tapp's output.

    so there you go. you can do this too with Apache or anything else..

    I tried to make it toggle but I haven't been able to find a reliable way to detect if it's running.. i tried doing a ps aux | grep sshd | grep -v grep which I know for a fact I've used in other linux/darwin applications but for some reason it didn't work here.

    but this may be better tho, this way you can't think it's turned off, and then click it "oops it was on, well now i just turned it off" type thing.

    enjoy and feel free to make it better

    edit: oh, i made a dir /tapp to put these in, and then you have to chmod 755 them to make them executable, then just put the stuff in .tapp, like so:

    I recommend setting the term to xterm before using vi coz it seems for some reason vi likes to crash with a bus error when hitting backspace if you are using the default TERM value .. or just use nano/pico.
    Last edited by hillie; 2007-09-14 at 04:42 AM.
    2007-09-14 04:36 AM
  2. LimitedEditioniPhone_com's Avatar
    can you write a guide how to install this? I have no idea what tapp is. I have it on my phone and would like to disable ssh and enable it. You are draining battery having it running correct?
    2007-09-14 09:18 PM
  3. hillie's Avatar
    There should not be any battery drainage as a result of simply having OpenSSH running on the system.

    The only possible drainage would arise from actively using it by being connected to the iPhone and doing stuff, but an idle running ssh daemon isn't going to make much difference in battery life.

    The problem with using ssh a lot comes with that when the phone goes to sleep (locks) it shuts off the wi-fi which kills any open ssh connection, so the only way to keep wi-fi on it seems is to either turn the auto-lock off or open a page in Safari that refreshes every 59 seconds (Nate True has one on so I assume he did this)

    As far as Tapp goes.. it's a simple app that just runs Unix shell scripts. You edit a file in root's home directory on the phone called .tapp and simply put in commands to run in that file. There aren't any labels for the commands or anything, it's just a list of command lines. I made scripts in a folder called tapp off the root to make it easy to see in the screen.

    So ie:

    nano ~/.tapp , then put in the file:

    command1 (ie. ifconfig en0, ls -l /var/root, etc.)

    You're supposed to be able to write the commands right on the phone but I haven't been able to do it. I have, however, been able to edit them, once I've already put them in the .tapp file.

    Also the app starts in "edit" mode so you have to tap the "Execute" button on the top left to get it to where you can tap the stuff to execute it.

    it seems REALLY dirty but hey, it works and it's safer than UIctl lying around your springboard

    I have updated the scripts so that they don't need the temp file. I have them in a svn repo but haven't yet installed the apache module, so for now they're in:
    2007-09-15 11:21 PM
  4. LimitedEditioniPhone_com's Avatar
    still have no clue what to do. Any chance you can write a step by step guide?
    1). install tapp from
    2.)...thats where I am stuck
    2007-09-16 03:26 AM
  5. hillie's Avatar
    ok.. I will write a guide while I wait for my pizza to arrive

    sorry for the double post, but I wanted this to be bumped.. (dunno if editing does that?)

    anyhow.. I wrote a guide for it, the guide's available at:

    It should be very easy to follow. Please excuse some formatting issues I had. Apparently the wordpress editor really sucks when it comes to putting in lots of images, etc.. :-\ and it seemed to play musical chairs with the font sizes.

    if anyone here can recommend maybe some alternative to wordpress that has an html editor that doesn't suck? or at least one that does what you tell it to do without thinking it knows html better than you do, then by all means don't hesitate to tell me !
    Last edited by hillie; 2007-09-17 at 04:35 AM. Reason: Automerged Doublepost
    2007-09-16 11:20 PM
  6. LimitedEditioniPhone_com's Avatar
    Thanks! they work great!! what other kinds of scripts can you do with Tapp?
    2007-09-17 08:22 PM
  7. hillie's Avatar
    Whatever you can think of, and whatever is supported by the iPhone's array of commands.

    I am sure the list of commands is a lot smaller than the list on a Linux or Mac OS X box.

    but I've written our web statistics automation program at work in Bash, and the program that actually creates the statistics graphs/pages/analysis is written in Perl, which you can install on the iPhone from

    so the possibilities are endless. The one limit of Tapp seems to be you can't read input from the user. If you use any commands that would require that the user type something it would just hang I'd imagine.

    I'm planning on making a backup/restore script that would backup all of your non-standard apps and also settings/hacks/etc. up to your Mac automatically, and then restore it to your phone. In the event of problems that arise with iTunes updates, etc. or just straight up disaster..

    You can check my blog for updates. i'm pretty busy right now but I DO want to make this script because I don't think anyone really has a one-click way to backup their stuff yet.

    This includes by the way, your e-mail, camera roll, non-standard apps, and any other settings I learn where the files are for. The only requirement unfortunately is that you have an ssh daemon running on the other end. Mac has it out of the box. PC users would have to install Cygwin.
    2007-09-19 12:18 PM
  8. shizzabrick's Avatar
    Why not just use UICtl... use unload -w and load -w options with ssh when you need it... no typing!
    2007-09-22 07:25 AM
  9. hillie's Avatar
    This solution has no typing.

    The reason I don't use UIctl is because it gives any random person the power to brick your phone.

    I do have UIctl installed but it is located elsewhere on the phone where you have to know Unix and manually move it to /Applications to get it to work.

    Plus UIctl ALSO only turns the service on/off.. Eventually I will have a one-button solution to changing autolock to never and starting ssh when I click "StartSSH" and set it back to 1min (or whatever) when I click "StopSSH"
    2007-09-24 01:57 PM
  10. Taken's Avatar
    I followed that guide and it doesn't work, Tapp doesn't execute scripts. I think that Tapp doesn't work on my 1.1.1 iPhone
    2007-12-13 05:07 PM
  11. fastdump's Avatar
    Eventually I will have a one-button solution to changing autolock to never and starting ssh when I click "StartSSH" and set it back to 1min (or whatever) when I click "StopSSH"
    How soon is eventually?...

    I've been scouring the web & forums looking for precisely this - particularly to toggle between auto-lock=never & auto-lock=[value]... and for precisely the same reason, because whenever I want to enable SSH I also want to set auto-lock to never, and vice versa.

    Can anyone write either a simple app or scripts that toggle either the auto-lock setting or both auto-lock and SSH?... Then it could be easily added to BossPrefs, which can already toggle SSH on & off but also has a function where you can enter details to start/stop other processes.
    Last edited by fastdump; 2008-03-15 at 07:19 AM.
    2008-03-15 07:16 AM