PuTTY - starting from command line with logging enabled - SSH

This is a discussion on PuTTY - starting from command line with logging enabled - SSH ; I am in a 100+ unix server environment, and due to some security requirements, instead of using my master administration server as a jumpboard, now I have to launch separate sessions to each of these servers when I need to ...

+ Reply to Thread
Results 1 to 10 of 10

Thread: PuTTY - starting from command line with logging enabled

  1. PuTTY - starting from command line with logging enabled

    I am in a 100+ unix server environment, and due to some security
    requirements, instead of using my master administration server as a
    jumpboard, now I have to launch separate sessions to each of these
    servers when I need to login. I am quite sufficient in unix
    environment and do whatever I wish to do but when it comes to windows,
    writing batch files is harder than pulling teeth.

    Now, my requirement is, when I launch an ssh session, I want it to
    start with logging enabled, but I do not want to go and manually
    create 100+ sessions (number expanding weekly, if not daily) and mark
    each session with logging enabled. This is not something feasible for
    me. I read thru the PuTTY manual but did not see any command line
    switch to accomplish this. I need to save my last, say 50, sessions
    screen input and output to any server I go into, on my local machine.
    I was hoping to write a batch file which will accept the server name
    as a command line argument and create a new log file with datestamp
    being part of the filename as well as the server name.

    I thought of using AutoHotKey to send a series of keystrokes to the
    terminal window to open up the context menu (drop down from upper left
    corner) but could not figure out if there is a way to drop it down
    with a key stroke. I tried, many combinations of win-alt-ctrl-shift
    with any alphabetical and numerical keys but was not able to drop down
    the context menu.

    If anyone was able to accomplish this before, I really would like to
    hear how you did it.

    Thanks in advance.

  2. Re: PuTTY - starting from command line with logging enabled

    On Wed, 20 Aug 2008 07:56:47 -0700 (PDT), Nomad wrote:
    > I am in a 100+ unix server environment, and due to some security
    > requirements, instead of using my master administration server as a
    > jumpboard, now I have to launch separate sessions to each of these
    > servers when I need to login. I am quite sufficient in unix
    > environment and do whatever I wish to do but when it comes to windows,
    > writing batch files is harder than pulling teeth.


    > Now, my requirement is, when I launch an ssh session, I want it to
    > start with logging enabled, but I do not want to go and manually
    > create 100+ sessions (number expanding weekly, if not daily) and mark
    > each session with logging enabled. This is not something feasible for
    > me. I read thru the PuTTY manual but did not see any command line
    > switch to accomplish this. I need to save my last, say 50, sessions
    > screen input and output to any server I go into, on my local machine.
    > I was hoping to write a batch file which will accept the server name
    > as a command line argument and create a new log file with datestamp
    > being part of the filename as well as the server name.


    > I thought of using AutoHotKey to send a series of keystrokes to the
    > terminal window to open up the context menu (drop down from upper left
    > corner) but could not figure out if there is a way to drop it down
    > with a key stroke. I tried, many combinations of win-alt-ctrl-shift
    > with any alphabetical and numerical keys but was not able to drop down
    > the context menu.


    > If anyone was able to accomplish this before, I really would like to
    > hear how you did it.


    You don't use command line switches. You set up a named session,
    for example, toUnixServer, then set all the options you want for
    that session including logging (see Session, Logging), then load
    it at PuTTY startup:
    putty -load "toUnixServer"

    The log file can be customized to include hostname, date and time.

    See the documentation (especially section 4.2):
    http://www.chiark.greenend.org.uk/~s...utty/docs.html

    --
    Dale Dellutri (lose the Q's)

  3. Re: PuTTY - starting from command line with logging enabled

    On Aug 20, 8:25*am, Dale Dellutri wrote:

    > You don't use command line switches. *You set up a named session,
    > for example, toUnixServer, then set all the options you want for
    > that session including logging (see Session, Logging), then load
    > it at PuTTY startup:
    > * putty -load "toUnixServer"
    >
    > The log file can be customized to include hostname, date and time.


    This is the very thing that I am trying to avoid. Today I have 100+
    servers tomorrow it will be 120 next year it will be god knows how
    many. Trying to keep track of them by this manually creating session
    files, is not something I want to do continuously. This is the thing
    that I am trying to circumvent if you read my original message.
    Otherwise I know the existence of this option. It just is not feasible
    for me to employ.

  4. Re: PuTTY - starting from command line with logging enabled

    Nomad wrote:
    > On Aug 20, 8:25?am, Dale Dellutri wrote:
    >
    >> You don't use command line switches. ?You set up a named session,
    >> for example, toUnixServer, then set all the options you want for
    >> that session including logging (see Session, Logging), then load
    >> it at PuTTY startup:
    >> ? putty -load "toUnixServer"
    >>
    >> The log file can be customized to include hostname, date and time.

    >
    > This is the very thing that I am trying to avoid.


    I don't follow. Don't you want a command line option?

    How is 'putty -load "toUnixServer"' significantly different for you from
    a hypothetical (but unavailable) option like --logging?

    --
    Darren

  5. Re: PuTTY - starting from command line with logging enabled

    On Wed, 20 Aug 2008 10:30:13 -0700 (PDT), Nomad wrote:
    > On Aug 20, 8:25?am, Dale Dellutri wrote:


    > > You don't use command line switches. ?You set up a named session,
    > > for example, toUnixServer, then set all the options you want for
    > > that session including logging (see Session, Logging), then load
    > > it at PuTTY startup:
    > > ? putty -load "toUnixServer"
    > >
    > > The log file can be customized to include hostname, date and time.


    > This is the very thing that I am trying to avoid. Today I have 100+
    > servers tomorrow it will be 120 next year it will be god knows how
    > many. Trying to keep track of them by this manually creating session
    > files, is not something I want to do continuously. This is the thing
    > that I am trying to circumvent if you read my original message.
    > Otherwise I know the existence of this option. It just is not feasible
    > for me to employ.


    Then do it this way:

    1. Modify the Default session to include logging with a
    file name like unixserver-&H-&Y&M&D&T.log in whatever
    directory you choose. The H will be filled in with
    the hostname, YMDT with the year, month date time.
    Save the Default session

    2. In your batch file, start putty like:
    putty.exe -ssh %user%@%host%
    (I think that's the right DOS syntax)
    where %user% and %host% will be filled in as you
    described.

    This will use the Default session which you already
    modified to include logging.

    All of this is described in the documentation at:
    http://www.chiark.greenend.org.uk/~s...utty/docs.html

    --
    Dale Dellutri (lose the Q's)

  6. Re: PuTTY - starting from command line with logging enabled

    On Aug 21, 4:18*am, Dale Dellutri wrote:

    > Then do it this way:
    >
    > 1. Modify the Default session to include logging with a
    > *file name like unixserver-&H-&Y&M&D&T.log in whatever
    > *directory you choose. *The H will be filled in with
    > *the hostname, YMDT with the year, month date time.
    > *Save the Default session
    >
    > 2. In your batch file, start putty like:
    > * *putty.exe -ssh %user%@%host%
    > *(I think that's the right DOS syntax)
    > *where %user% and %host% will be filled in as you
    > *described.
    >
    > This will use the Default session which you already
    > modified to include logging.
    >
    > All of this is described in the documentation at:
    > *http://www.chiark.greenend.org.uk/~s...utty/docs.html
    >
    > --
    > Dale Dellutri (lose the Q's)



    I tried doing this. I inserted a fixed log name, nothing fancy with %
    signs and such, enabled logging everything (not just printable
    characters) just to test and saved the default but when I start a
    session, it still starts without the logging enabled.

  7. Re: PuTTY - starting from command line with logging enabled

    On Aug 20, 5:17*pm, ddun...@taos.com (Darren Dunham) wrote:
    > Nomad wrote:
    > > On Aug 20, 8:25?am, Dale Dellutri wrote:

    >
    > >> You don't use command line switches. ?You set up a named session,
    > >> for example, toUnixServer, then set all the options you want for
    > >> that session including logging (see Session, Logging), then load
    > >> it at PuTTY startup:
    > >> ? putty -load "toUnixServer"

    >
    > >> The log file can be customized to include hostname, date and time.

    >
    > > This is the very thing that I am trying to avoid.

    >
    > I don't follow. *Don't you want a command line option?
    >
    > How is 'putty -load "toUnixServer"' significantly different for you from
    > a hypothetical (but unavailable) option like --logging?
    >
    > --
    > Darren


    How it is different is, when you use -load option, you are
    assuming that the profile already exists and saved. I am trying to
    avoid creating 100+ profiles, one-by-one as well as having to remember
    to create a new profile everytime a new server gets added to the
    landscape.

  8. Re: PuTTY - starting from command line with logging enabled

    On Thu, 21 Aug 2008 06:22:36 -0700 (PDT), Nomad wrote:
    > On Aug 21, 4:18?am, Dale Dellutri wrote:


    > > Then do it this way:
    > >
    > > 1. Modify the Default session to include logging with a
    > > ?file name like unixserver-&H-&Y&M&D&T.log in whatever
    > > ?directory you choose. ?The H will be filled in with
    > > ?the hostname, YMDT with the year, month date time.
    > > ?Save the Default session
    > >
    > > 2. In your batch file, start putty like:
    > > ? ?putty.exe -ssh %user%@%host%
    > > ?(I think that's the right DOS syntax)
    > > ?where %user% and %host% will be filled in as you
    > > ?described.
    > >
    > > This will use the Default session which you already
    > > modified to include logging.
    > >
    > > All of this is described in the documentation at:
    > > ?http://www.chiark.greenend.org.uk/~s...utty/docs.html


    > I tried doing this. I inserted a fixed log name, nothing fancy with %
    > signs and such, enabled logging everything (not just printable
    > characters) just to test and saved the default but when I start a
    > session, it still starts without the logging enabled.


    I just tried this and it worked.

    When you set up the "fixed log name", did you first browse to
    a folder in which you have write permission? (The default
    is probably not writable by you.)

    Are you sure you saved the Default? If you bring up PuTTY via
    the GUI, are your settings showing in the Session Logging config
    panel?

    Also, the "fancy" log names use "&" before variable names,
    not "%".

    --
    Dale Dellutri (lose the Q's)

  9. Re: PuTTY - starting from command line with logging enabled

    Nomad wrote:
    > On Aug 20, 5:17?pm, ddun...@taos.com (Darren Dunham) wrote:
    >
    >> How is 'putty -load "toUnixServer"' significantly different for you from
    >> a hypothetical (but unavailable) option like --logging?

    >
    > How it is different is, when you use -load option, you are
    > assuming that the profile already exists and saved. I am trying to
    > avoid creating 100+ profiles, one-by-one as well as having to remember
    > to create a new profile everytime a new server gets added to the
    > landscape.


    Why would you need 100+ profiles for this? Just use whatever you use
    today, enable logging, save a profile for it, then use that profile as
    the argument to -load. That's only one profile....

    --
    Darren

  10. Re: PuTTY - starting from command line with logging enabled

    Nomad wrote:
    > How it is different is, when you use -load option, you are
    > assuming that the profile already exists and saved. I am trying to
    > avoid creating 100+ profiles, one-by-one as well as having to remember
    > to create a new profile everytime a new server gets added to the
    > landscape.


    Ahh, I see. It's not so much *enabling* the logging as getting the
    filename set usefully based on the host you're connecting to. That was
    the bit I misunderstood.

    --
    Darren

+ Reply to Thread