Ssh gotcha--was: Why my script starts working when I try to debug it?

I came across a strange ssh gotcha while debugging a script that sets up an ssh tunnel. It's a complex script, I won't bother with the details.
Here's the relevant ssh command, run on the client to set up a tunnel from the server back to it.
ssh -o "ExitOnForwardFailure=yes" -o "ServerAliveInterval=30" -o "PermitLocalCommand=yes" -o "LocalCommand=touch $TUN_SSH_READY" -i /root/.ssh/id_rsa_tunnel -b "$addr" -R "$SERVERPORT":localhost:"$LOCALPORT" -N -l root "$SERVER"
Everything was working for a week or so, now it suddenly didn't. Restarting sshd on both machines didn't help. The bottom line was, there seemed to be two problems:
1. Although I had
-o "PermitLocalCommand=yes" -o "LocalCommand=blahblah"
specified on the command line, this seemed suddenly to have stopped working. This problem disappeared during debugging. I never did figure out why it was happening. Maybe it's connected to problem 2.
2. Turns out that I had ssh-agent running, and loaded in it was a different ssh key for root@server. (The keys are restricted in what commands they can run, so different keys for different purposes.) And ssh was using this key from ssh-agent instead of the key I specified on the command line with
-i /root/.ssh/id_rsa_tunnel
Huh, I would have expected the command line to override ssh-agent, but apparently not. I've read up on ssh pretty well, but this surprised me. Once I knew what to look for, though, I was able to find other reports of it, such as here. I had noticed discussion of multiple identities in the man pages, but I hadn't understood that ssh_agent could usurp the command line.
Solution was to add
-o "IdentitiesOnly=yes"
to my ssh command, then ssh-agent is ignored.
Last edited by Profjim (2009-08-20 13:18:36)

[whoops, I hit quote instead of edit. can't make this second post disappear.]
Last edited by Profjim (2009-08-20 13:19:24)

Similar Messages

  • Why does itunes stop working when I try to watch videos

    When I try to watch videos on my pc and itunes stop working.  Why is this happening?

    Try the following user tip:
    iTunes for Windows 10.7.0.21: "iTunes has stopped working" error messages when playing videos, video podcasts, movies and TV shows

  • Why does iTunes stop working when I try to type the album name in to submit cd track names?

    I have a cd that I'm trying to separate, but whenever I try to type the album name in the submit CD track names box, iTunes freezes, then quits working. Why is it doing this and what can I do to stop it?

    Does it happen for any slideshow? Or only for one slideshow with certain images?
    Does iPhoto also freeze for a new iPhoto library, if you create a new library with some test images?
    If iPhoto only freezes for a certain slideshow, check, if it is one of the photos or videos, that is making the slideshow freeze. Create a new slideshow and add the images one by one, to fnd the one, that cannot be played. Remove it.
    If iPhoto only freezes with all slideshows in your current library, repair your iPhoto library. It may have been migrated with permission issues. How did you restore the library, after you wiped your mac and clean-installed?
    To repair the library using the First Aid Tools, see Old Toad's post here: Rebuild iPhoto Library, Version 11, see "Fix 1". In your case, I'd start with Repair Permission, the Repair database. Apply the other fixes, if need be.
    Post back, if the repair does not help.
    Léonie

  • Why is gmail not working when I try to set up in Mail?

    I cannot set up my mail account. i try to set it up but when I enter my information, it says: Logging in to the Gmail IMAP server “imap.gmail.com” failed. Make sure the user name and password you entered are correct, then click Continue. If the information isn’t correct, you cannot receive messages.
    What is wrong?

    how are you connecting to the internet?
    think is many mobile network providers block various ports which some mail services rely on

  • Why does Itunes stop working when I start to play a movie

    Why does Itunes stop working when I start to play a preview or watch a downloaded movie rental

    Let's try the following user tip with that one:
    iTunes for Windows 10.7.0.21: "iTunes has stopped working" error messages when playing videos, video podcasts, movies and TV shows

  • Why does my adobe audition cs6 stop working when i try and make an edit in windows 7?

    why does my adobe audition cs6 stop working when i try and make an edit in windows 7?

    You might get more help asking in Audition CS5.5, CS6 & CC
    This forum is about the Cloud as a delivery process, not about using individual programs
    If you start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • How do you fill in a form that was saved as a template? When I try, the "template" shifts, which is not how a template should work!

    How do you fill in a form that was saved as a template? When I try, the "template" shifts, which is not how a template should work!
    Templates, as I understand them, are fixed; you can "fill them in" without shifting them. Yet, I've saved doc as a template AND it shifts. Argh!

    Thanks for your response.
    I've managed to fix it but I wouldn't recommend the following as I'm sure its unsupported and I'll probably have problems down the line
    On the host
    * mv /etc/zones /etc/zones.bak
    * reboot single user
    * apply kernel patch (the one that ultimately I had to get on and which was giving pre-req dependency errors when running zones)
    * create a new zone now that host system is all up to date
    * Copy the operating system directories of the new zone (the one that's all patched) over the troublesome zone (the one that can't take the patch). Take backups first
    * cd /zones/new-zone/root
    * find sbin -print | cpio -pudm /zones/bad-zone/root
    * find usr -print | cpio -pudm /zones/bad-zone/root
    * find lib -print | cpio -pudm /zones/bad-zone/root
    * cd /zones/new-zone/root/var
    * find sadm -print | cpio -pudm /zones/bad-zone/root/sadm (this copies patches and pkgs directories and I'm sure a lot of other stuff that I didn't want)
    * mv /etc/zones.bak /etc/zones
    * reboot host
    * boot the old zone up. It should now have up to date patches
    I'm sure there are real no-no's in taking this approach but it seems to have worked for me. I'll update if I find there are some horrors down the line
    Edited by: paul_xedos on Mar 25, 2010 4:07 AM

  • Why does fix capitalization work when there is only one space after the period in pages 09?

    why does fix capitalization work when there is only one space after the period in pages 09?  For example:  "Turn on 3rd St. After the traffic light."  There is only one space after the period in "St."  shouldn't it only auto correct after TWO spaces..??  the word After, should be after..

    You may also use a noBreak space after the period at the end of the abbreviation.
    If I remember well, in such case the capitalization will not apply.
    Yvan KOENIG (VALLAURIS, France) mercredi 27 avril 2011 23:34:46

  • Why this path doesnt work when there is "!DOCTYPE" element?

    Hi, I need to extract contents from an xml file, which looks like
    <hr />
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE article PUBLIC "-//ES//DTD journal article DTD version 5.0.1//EN//XML" "xyz501.dtd" > <!-- LINE 1 -->
    <article docsubtype="fla">
    <item-info>
    <jid>YANBE</jid>
    <aid>12941</aid>
    </item-info>
    </article>
    <hr />
    And I have tested with this path "//article/item-info/jid/text()", but it doesnt give me anything. But I noticed that when I remove line 1, it does extract the content "YANBE"...
    why the path doesnt work when there is that DOCYTYPE element? How should I get around with this please?
    Many thanks!

    The extract of XML you gave is not valid (Line 1: <hr/>) but besides that ... I think your problem is in the DTD.
    Somewhere in the DTD it probably 'sneakily' defines a default attribute which in reality is a default-namespace for one of the elements. This means that in your XPath handling, you will have to map a prefix to a namespace-uri (NamespaceContext [1]) and use this newly defined prefix in your XPath expression.
    //tst:article/tst:item-info/tst:jid/text()[1] http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/namespace/NamespaceContext.html

  • Why won't my adobe flash drive work when I try to use it?

    Why wont my adobe flash drive work when I try to use it?  I am going to school online and I just bought this mac book pro.  My old mac book worked just fine with the adobe flash drive and shackwave.

    You must mean Adobe Flash Player and Adobe Shockwave Player. Get the latest versions here:
    http://www.adobe.com/downloads/
    Right side column.

  • Why does my Photoshop 10 application stop working when I try to sign in?

    Why does my photoshop10 application stop working when I try to sign in?

    See this post for the reason and solution:
    http://forums.adobe.com/message/5721815#5721815

  • I am using iPad1. Running v4.3 and when connecting to wifi iPad keyboard does not work. Keyboard works for everything else including typing this question out. Why would it not work when typingin password for wifi connection?

    I am using iPad1. Running v4.3 and when connecting to wifi iPad keyboard does not work. Keyboard works for everything else including typing this question out. Why would it not work when typingin password for wifi connection?

    Kowhai wrote:
    Lots of WIFI needs a username and password to get access. I guess you're lucky and yours is set up unsecured.
    Normal secured WiFi requires only a password to get access. The password is used to encrypt traffic between your device and the WiFi access point. If whatever you are using requires a username as well then it is not simply normal secured WiFi. It might be a subscription WiFi service like GOGO, ATT, etc., or a service with authentication, i.e., college campus, etc. To help you out we need to know what you are using and what connection dialog you are being presented with. You don't have exactly the same problem as the original poster. He is having a problem entering a password into the password dialog that iOS presents when one tries to connect to a normal secured WiFi network. Could you clarify exactly which WiFi service you are using.

  • Why does my iTunes stop working when i try to sync music to my iPhone?

    Why does my iTunes stop working when I try to sync music to my iPhone?

    Morning Bandg72,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at this article:
    iTunes for Windows Vista or Windows 7: Troubleshooting unexpected quits, freezes, or launch issues
    http://support.apple.com/kb/ts1717
    Best of luck,
    Mario

  • Excel has stopped working when I try to launch Excel 2013 Powerpivot

    Redirected from the Win 7 forum: (http://answers.microsoft.com/en-us/office/forum/office_2013_release-excel/excel-has-stopped-working-when-i-try-to-launch/01460690-abab-495f-ab5f-904f72f88668)
    My system is a Windows 7 machine, 64 bit
    I previously had Excel 2010 32bit with 32 both Powerpivot installed.  However I am currently evaluating 64 bit Excel 2013 with Powerpivot for my company so I uninstalled Excel 2010 and installed an evaluation copy of Excel 2013 64 bit.
    However whenever I launch Excel, enable Powerpivot, then click any of the Powerpivot buttons it gives me an error saying "Excel has stopped working".
    I took a look in the Windows events logs and found:
    Faulting application name: EXCEL.EXE, version: 15.0.4420.1017, time stamp: 0x506741b5
    Faulting module name: mscorwks.dll, version: 2.0.50727.5477, time stamp: 0x5265c8ee
    Exception code: 0xc0000005
    Fault offset: 0x00000000002ba203
    Faulting process id: 0x3e8c
    Faulting application start time: 0x01cf52a7644eda9d
    Faulting application path: C:\Program Files\Microsoft Office\Office15\EXCEL.EXE
    Faulting module path: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
    Report Id: afa4f824-be9a-11e3-94ac-415645000030
    I have tried uninstalling and re-installing as well as doing a Repair on my .net framework, which is the latest version.

    You can go to check the dll file, what's size of this dll file?
    If the file size is 0 byte, you can check the link below:
    http://forums.steampowered.com/forums/showthread.php?t=2735528
    Also you can go to check the disabled items (File->Options->Add-ins->Disabled items->Go) to see if any dll file was disabled.
    In addition, Isn't the latest version of .NET Framework supposed to be 4.0?(Not quite familiar with this)
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee
    the accuracy of this information.
    Wind Zhang
    TechNet Community Support

  • PSE 11 Organizer quits working when I try to create a slide program.

    How do I correct the problem of PSE 11 organizer not working when I try to create a slide program.

    I've got the same problem. I have just bought a Windows 7 PC with an i7 processor and 8Gb RAM. This wasn't an issue with my previous PC running Windows XP and PSE 6 so I thought it was down to PSE 6 and Windows 7 being somehow incompatible. I therefore downloaded a trial of PSE 8 but this also crashes every time I try to create a slide show.
    I have uninstalled Intervideo WinDVD as recommended by John's link and followed the other instructions as well but this bug doesn't seem to go away.
    However a workaround for me is that I can open previous slide shows (created under Windows XP and PSE 6), edit them and save as a new project. The slide show function is still very very unstable however and I have to save after each single successful action. It seems to crash at random but mostly when I try to insert any music into a project. It can be very frustrating and time-consuming for something that should be a very simple task for a grown-up, expensive program.
    Anybody got any other ideas? Of course I've reported this to Adobe but I'm not expecting a reply (I've never had one so far so why should they change?).

Maybe you are looking for