1 2 Previous Next 16 Replies Latest reply on Sep 2, 2015 10:39 AM by Mike Reider

    NSH with putty

    Gerardo Bartoccini

      I always use NSH with putty on Windows and I like it very much.


      For those that don't know what I'm talking about, NSH client on Windows is based on cygwin, which has got an ugly default shell based on DOS cmd.

      You can use a custom flavor of putty instead.


      Go to http://code.google.com/p/puttycyg/ and download the latest version (hopefully you don't have conflicts, but the compatibility is quite wide).


      Extract the content under OM/bin, create a shortcut for putty.exe and then edit the Properties so that the Target of the Shortcut looks like:


      "C:\Program Files\BladeLogic\OM\bin\putty.exe" -cygterm nsh


      (change the path according to your installation)


      Remember that, if you use NSH proxy server, you need to authenticate with the standard NSH client, then you can use putty.


      Now, my problem:


      I have used this procedure many times and it always worked. I have done the same this morning for a customer, and it doesn't work.

      After some troubleshooting we got it working prepending a ".\" to nsh, as follows:


      "C:\Program Files\BladeLogic\OM\bin\putty.exe" -cygterm .\nsh


      Unfortunately, this works when running putty, but doesn't when using it in a Custom Command.


      For sake of clarity, the Custom Command is a Local GUI with the following command:


      putty -cygterm nsh -D //%H"%p"


      I have tried something like this:


      putty -cygterm .\nsh -D //%H"%p"


      or this:


      putty -cygterm ./nsh -D //%H"%p"


      or with different combination of back and forward slashes, but nothing works.

      I believe it's a matter of path, but editing the Windows %PATH% environment variable didn't help.


      Did anybody incur in such an issue before?




        • 1. Re: NSH with putty

          You are a grand, grand person for providing a pointer to this version of PuTTY. :)


          As such, I shall give an attempt at an answer. The puttycyg README file says this:


          The Cygterm backend (or protocol) is made available in the standard
          configuration dialog or on the command line via the -cygterm option. The
          command supplied in the configuration dialog or on the command line is used by
          Cygterm as a command line to execute in the pseudoterminal. On the command
          line, the first non-option argument will end argument processing and the
          remaining arguments will be taken as the command line to execute.


          Thus, maybe you need to provide the full path information for nsh.exe for the custom command to work:



          putty.exe -cygterm C:\PROGRA~1\BLADEL~1\OM\bin\nsh.exe


          ...or something along those lines?

          • 2. Re: NSH with putty
            Gerardo Bartoccini

            This could be actually a solution but, given the fact that a Custom Command can be used by pretty much anybody, if the user has a different path for nsh (assume you've installed NSH on D:, for instance) then it wouldn't work.


            BTW, let me know if it works fine for you :)

            • 3. Re: NSH with putty

              Maybe in that case, an Environment Variable that points to it?


              %ProgramFiles%\BladeLogic\ ...etc.

              • 4. Re: NSH with putty

                I just did this in 8.2, and it worked fine.


                I copied the puttycyg stuff to "C:\Program Files\BMC Software\BladeLogic\NSH\bin"


                Added "Putty NSH Here" as a Local GUI


                command line:


                "C:\Program Files\BMC Software\BladeLogic\NSH\bin\putty.exe" -cygterm nsh.exe -D //%H"%p"

                1 of 1 people found this helpful
                • 5. Re: NSH with putty

                  Yes, it works without any problems.


                  The Directory "C:\Program Files\BMC Software\BladeLogic\NSH\bin"   is the best choice for this.



                  The command line:


                  putty -cygterm nsh -D  "//%H%p"

                  1 of 1 people found this helpful
                  • 6. Re: NSH with putty

                    You can try with mintty  [http://code.google.com/p/mintty/]


                    And creating the local command:


                    "C:\Program Files\BMC Software\BladeLogic\NSH\bin\mintty.exe" nsh.exe -D  //%H"%p"




                    1 of 1 people found this helpful
                    • 7. Re: NSH with putty

                      Thanks everyone, I've created a howto on this available here.

                      • 8. Re: NSH with putty
                        Mike Reider

                        anyone know how to run this so it logs in as root?


                        my local GUI command is like this,


                        "C:\Program Files\BMC Software\BladeLogic 3\NSH\bin\putty.exe" -cygterm nsh.exe -D //%H"%p"


                        but when it opens up a putty, it logs into the target as my windows AD login. Anyway to make it login as root?


                        Also the title on the putty window shows a different server name.


                        • 9. Re: NSH with putty
                          Bill Robinson

                          Use the nsh proxy ?

                          • 10. Re: NSH with putty
                            Mike Reider

                            we dont have a nsh proxy setup, but what I was looking for was more towards the way we run NSH with NEXEC to login as root,


                            Nexec Here = nsh -c "nexec %H bash"


                            this lets me connect to a target mapped as root


                            Im trying to pass the same parameter via putty but there doesnt seem to be a way of doing this using -cygterm
                            I tried it like this,


                            "C:\Program Files\BMC Software\BladeLogic 3\NSH\bin\putty.exe" -cygterm nsh -D "//%H%p" "nexec %H bash"

                            doesnt work

                            Im already calling nsh via cygterm, I just need to add another call for nexec as well.

                            • 11. Re: NSH with putty
                              Bill Robinson

                              If you do the putty call to nsh, if you do an agentinfo in that session do you have the proper blade creds and you are mapped to root ?

                              • 12. Re: NSH with putty
                                Mike Reider

                                running Putty NSH like this,

                                "C:\Program Files\BMC Software\BladeLogic 3\NSH\bin\putty.exe" -cygterm nsh -D "//%H%p"


                                Im mapped as my AD name not as root, agentinfo works,


                                ulvzndat21% whoami


                                ulvzndat21% agentinfo


                                  Agent Release   :

                                  Hostname        : ulvzndat21

                                  Operating System: Linux 2.6.32-504.3.3.el6.x86_64

                                  User Permissions: 0/0 (root/root)

                                  Security        : Protocol=5, Encryption=TLS1

                                  Host ID         : F00AFEA4

                                  # of Processors : 1

                                  License Status  : Licensed for NSH/CM


                                • 13. Re: NSH with putty
                                  Bill Robinson

                                  Instead of nsh run nexec directly ?

                                  • 14. Re: NSH with putty
                                    Yanick Girouard

                                    Just be wary that some commands, such as blcred (blcred cred -acquire ...), will not recognize the password input prompt properly inside putty because the command is expecting input from a dos command-prompt. Instead of hiding the password typed, it will print every character and will not work when submitted. If you find a way around that let me know !

                                    1 2 Previous Next