zoukankan      html  css  js  c++  java
  • Improving Putty (SSH) settings on Windows 关于SSH设置的详细说明

    http://dag.wieers.com/blog/improving-putty-settings-on-windows

    Improving Putty settings on Windows

    Submitted by dag on Sat, 2008/01/26 - 01:25

    Since I started contract work for a new customer and have been offered a Windows Thinkpad to connect to the internal network, I have been looking at ways to make my life more comfortable. Putty is now my window to the world work so let's look at how I can make Putty nicer to work with.

    PS: Some of these options work equally well for Putty on Linux, put there is little use for that combination.

    Skip directly to Putty settings summary.

    Configure your Putty first, then make entries.
    This is important advice. First configure your environment before you start using it. This is especially true for Putty, since you always start of from the default, it is important to configure the default entry before you create entries from these defaults. It will save you a lot of time afterwards to get things straight.

    So before you make any changes, open the default template in Category: Session by selecting Default Settings and pressing the Load button.

    Make SSH the default.
    If you have an older version of Putty, chances are that you have Telnet as the default protocol. Changing it to SSH will probably save you some time when you start Putty out-of-the-blue. For this go to Category: Session and select SSH.

    Increase scrollback buffer.
    By default Putty buffers 200 lines of output, which is too little in lots of circumstances. And the moment you actually need this number increased, chances are you already lost some information you wanted. So it is wise to increase this number. What I do is go to Category: Window and increase Lines of scrollback to 20000.

    Choose a good font.
    The newer Putty binaries are able to make use of ClearType which drastically improves the font quality compared to Antialiased. Go to Category: Window > Appearance, choose ClearType and a nice font. I prefer Lucida Console, 9-point.

    When you are there, you might want to change the Gap between text and window edge to 3 pixels.

    Use proper character encoding.
    Nowadays all Linux systems are able to use Unicode (UTF-8) so to make sure that the output in Putty (especially everything non-ascii) looks fine, go to Category: Window > Translation and change the character set to UTF-8, make sure that also the line drawing characters use Unicode as well.

    Linux copy-and-pasting.
    I prefer to do an implicit copy when selecting and using the middle mouse button for pasting. So I go to Category: Window > Selection and set the Action of mouse buttons to xterm (Right extends, Middle pastes)

    When you are there, also enable the option Paste to clipboard in RTF as well as plain text, which is nice when you are copy-and-pasting to emails or text documents that allow fonts and colours. Your console output will look much the same as it does on your screen!

    Change dark colours on a black background.
    One of the more annoying things with terminal applications (xterm has the same issue) is that by default dark-blue is too dark to be visible on a black background. Not only is this frustrating, it makes the experience for new users so bad that they prefer to disable colours (or hate the ls colour output or syntax highlighting in vim).

    So if you are like me, go to Category: Window > Colours and select ANSI Blue in the Select a colour to adjust to Red:74 Green:74 Blue:255. I do the same for ANSI Blue Bold to Red:140 Green:140 Blue:255.

    Keeping idle sessions active.
    Another frustrating problem is induced by the time-to-live of inactive or idle TCP sessions on firewall or switch configurations. At some companies this is put aggressively low so that TCP sessions that have no activity for 1 minute or even 30 seconds are being dropped. If you are using an SSH connection over such a network device, you have to take care to send keep-alive packets over your idle session. To do this go to Category: Connection and set Seconds between keepalives (0 to turn off) to 25.

    Enable X11 forwarding.
    Together with Xming, Putty allows you to run graphical Linux applications on your Windows system, so enabling X11 forwarding by default can be useful. To enable this, got to: Connection > SSH > X11 and enable Enable X11 forwarding.

    Also dynamic forwarding is very useful to connect to systems on a remote network, even when you do not know in advance having it enabled can be useful. This option however reserves a local port on the system so enabling it by default is not really practical. However you can still enable it from a running Putty by selecting Change settings.

    Finally, saving the default.
    Now, don't forget to save the changes you just made to the default template. If you loaded the Default Settings at the start, return back to Category: Session and press the Save button. Now you are done !

    Putty settings summary.
    Category: Session
    Connection type: SSH

    Category: Window
    Lines of scrollback: 20000

    Category: Window > Appearance
    Font: Lucida Console, 9-point
    Font quality: ClearType
    Gap between text and window edge: 3

    Category: Window > Translation
    Character set: UTF-8
    Handling of line drawing characters: Unicode

    Category: Window > Selection
    Action of mouse buttons: xterm (Right extends, Middle pastes)
    Paste to clipboard in RTF as well as plain text: enabled

    Category: Window > Colours
    ANSI Blue: Red:74 Green:74 Blue:255
    ANSI Blue Bold: Red:140: Green:140 Blue:255

    Category: Connection
    Seconds between keepalives (0 to turn off): 25

    Category: Connection > SSH > X11
    Enable X11 forwarding: enabled

    Other interesting features ?
    Let me know, so I can update this document for future visitors.

    colors

    The best way to fix the color problem is to set your term type to putty instead of xterm. xterm is black on white by default, so you'll get ls colors and vim syntax highlighting more suitable for a light background.

    If you want to change individual colors, try setting the LS_COLORS environment variable, or in Vim you can try running ":color blue", ":color evening", ":color ron", or any other color scheme name under the /usr/share/vim/vimversion/colors directory.

    Also note that PuTTY doesn't work well with the Consolas font and bold text, since the bold text is larger than the normal text. Lucida Console, Andale Mono, or Bitstream Vera Sans Mono are all really nice.

    I've never understood why anyone likes white text on black

    Category: Window
    Check: Reset scrollback on keypress
    Uncheck: Reset scrollback on display activity

    Category: Window > Appearance
    Font: Fixedsys is more readable than Lucida

    Category: Window > Colours
    Default Foreground: 85 85 85
    Default Bold Foreground: 0 0 0
    Default Background: 242 242 242
    Default Bold Background: 255 255 255
    Cursor Text: 85 85 85

    Vim/emacs syntax coloring shows up so much better this way.

    White text on black was a

    White text on black was a method of saving energy.

    Black is the default display color of the monitor and of all the other colors require the least amount of energy to display.
    White on the other hand requires the most.

    So having white text on black background is the most efficient

    > So having white text on

    > So having white text on black background is the most efficient

    Was the most efficient for CRTs. For LCDs it's the opposite.

    White Text Black Background

    I personnaly find that after hours of using putty/a computer that a White as a background it to sharp and hurts my eyes, simple solution (which was the main selling point to be on the new vista theme) is to change the colours so that you dont have anythign to sharp or bright.

    Not true on modern LCD

    Not true on modern LCD displays. Without applying power, 'transparent' is the default state for the crystal material, showing through to the CCFL (back light) behind, giving you a white screen. Therefore, black text on a white background will use slightly less power. Compared to the power drawn by the CCFL, this is negligible.

    P.S. Thanks for the tips on Putty!

    Besides, white on black is

    Besides, white on black is healthier for your eyes. Light-gray on black - even better

    nice write-up, didn't know

    nice write-up, didn't know about cleartype for example.

    concerning (non-default) settings for the work environment; i had to configure putty to connect through our company proxy, with my proxy username/password (under connection/ proxy). after changing the config of sshd on the server, to make it listen on port 443 as well (no https), i could connect to my remote linux box.

    Nice article!

    Nice article!

    Poderosa

    I keep putty and the rest of the putty utilities with me on a usb device but for day to day work I use Poderosa. http://en.poderosa.org/ It is a tabbed SSH client. I usually have 8 or 10 sessions open at any one time. Can do cygwin sessions, telnet and serial as well. Simple to work with keys. includes a simple port forwarding client. Split screens. It is a pretty impressive open source tool I have used for years.

    command line options/usage

    Personally, when I was stuck with putty, I'd simply put the binary somewhere in my path. From what I remember, you can access saved sessions as:

    putty @SessionName

    This also allows the convenience of:

    putty -ssh UserName@Host (or Host -l UserName, whatever floats your boat).

    Other options, including -X to forward X11 also work. Optionally, create a shortcut called ssh to run putty and set ssh as your default protocol (as you mentioned) and access the same way you would regular ssh. Obviously, this isn't quite what you're looking for, as they aren't really configuration options, but I've always found it silly that people insist on using the putty GUI. I always found it faster to hit Win+R and type something out.

    Disclaimer: I'm going by my memory here, as I don't have a Windows machine to verify my claims anymore.

    same here

    Yup, that's very similar to the settings I use.

    thanks man

    you just made my life much easier. Really appreciated these tips.

    Here's what I do since I

    Here's what I do since I live in the same environment.

    Do just like what you described above, then:

    Get putty tray after install:
    http://www.xs4all.nl/~whaa/putty/
    You can read the improvements on the site.

    Also, install launchy:
    http://www.launchy.net/

    Then the putty plugin for launchy:
    http://sourceforge.net/forum/forum.php?thread_id=1840503&forum_id=677087

    Now I just hit the "alt-space" type in "ssh " and viola connected.

    I also use xming for a X-Server:
    http://sourceforge.net/projects/xming.

    Cheers,
    eric

    Colors

    Nice overview. Putty has also the advantage of saving different kinds of settings into Sessions. Thus, connecting to a server is two clicks away. I save the most important server sessions and attribute a fore- and background color to each type of application environment (eg blue/yellow for our backup servers, etc...)

    Putty Connection Manager

    You should take a look to the add on to putty: Putty Connection Manager

    It's a nice tool to allow to work with tabbed sessions.

    http://puttycm.free.fr

    I like it

    Putty+ViM/Vi+Num Pad != madness

    My major issue with Putty for a ling time has been that when using the numpad in ViM or Vi it would print letters, delete lines and general maddens.

    Quick Google search returned: http://www.cialug.org/pipermail/cialug/2005-June/003060.html

    To summaries use:
    Category: Terminal->Features->Disable Application keypad mode

    Hope this helps others! :)

    vim color syntax highlighting over PuTTY ?

    I have been hunting through many forums for many hours on a way to get vim color syntax highlighting to work via PuTTY for shell scripts. the "set sytax enable" setting is in ~/.vimrc and locally on the CentOS system, color sytax works perfectly. However, when I connect to the system via PuTTY, although ls commands will show colors as defined in /etc/DIR_COLORS.xterm, if i edit a script in vim, there is never any color highlighting. Please can someone show me how to make the color syntax highlighting work in a PuTTY session running vim ??

    vim-enhanced and the vim command

    You should have the package vim-enhanced installed as well as use the "vim" command, not necessarily the "vi" command.

    This is different when you are user root, or when you are another user on the system.

    The Problem with Putty background

    I'm finding the problem with changing default putty colors is that you can't just change foreground and background colors because when you do so, all ls -l colors show up very badly like the cyan colors and greens and light blues. I'm still looking for a all-encompassing color scheme that's better on the eyes. :-\

    Changing those colors too

    You can also change the cyan, green and light blue to be darker on a white background in Putty as well. As long as they are using normal ANSI colors, you can even change yellow in dark red if you like.

    go portable: portaputty

    I've switched to portaputty, a portable putty client.

    The nice thing is the configs are stored as files in a .putty directory. (of course it's not hidden on windows..)

    This allows for portability, but also for very easy settings editing - I'd dread to change a specific setting in 20 sessions in the gui.

    Start Putty from the run command

    - Place the putty.exe executable in the Windows System32 folder

    - Open run dialog: Windows key + r
    - In the run box, type "putty -ssh -P 22 ip_address" and hit enter.

    PuTTY is good.

    Excellent little configuration guide here, I seemed to have missed configuring PuTTY all together, but now I have it set up nice thanks to you.

    Also thanks to the other commentors mentioning:

    Tip: Also if you like to go full screen with Alt+Enter (like cmd box on Windows), when configuring the default profile make sure to select/tick - Category: Window, Behaviour, Full screen on Alt+Enter :)

    Lucida Console is a Greate Font

    I have learned to love Lucida Console 9 -point because it is as viewable at a 10 point font but saves 10% of your screen space. Initially it takes a while to get used to it but give it a few weeks and you will use it in everything. I use it in RAD tools and eclipse too.

    Don't forget about cygterm and transparent PuTTY!

    This is a really great post--thanks for the information. As a user of the mutt e-mail client with vim on cygwin through PuTTY, the information about color setting was very helpful.

    Don't forget about putty-ntrans, the transparent PuTTY that lets you see the background image through (in part or totally) the PuTTY session. And cygterm, the PuTTY with support for cygwin.

    Putty behaviour

    In addition to all this, I like to set the putty behaviour to "System menu appears on ALT alone". I'm often doing captures of long diagnostic outputs, and I want to clear the scrollback buffer before I start. With this setting, a quick "ALT-t ALT-l" on the keyboard (Reset terminal, clear scrollback) and my sessions is all nice and tidy. Once the diagnostic session ends, ALT-o (copy to clipboard) is all I need to do to get the output into a decent text editor. There are other useful commands on the system menu that are now instantly accessible, for us mouseophobes.

    increase line spacing for a more readable font

    I don't know how to do this, but perhaps someone else does...

    If you closely compare the standard gnome terminal font against Putty with Lucida Console, you'll notice that the gnome terminal font is more readable because there is more space between the baseline of one row and the tops of characters in the row below.

    Is there an easy way to adjust the line spacing of a font in Windows?

  • 相关阅读:
    Balsamiq Mockups完全手册
    LPTSTR、 LPCSTR、LPCTSTR、LPSTR的来源及意义(转)
    Socket编程
    在窗口中绘图(转)
    写博客
    _beginthread还是CreateThread (转)
    CString 与其他类型的转换
    TCP/IP 详述 (转大部分)
    解决svgview控件ax_XXX_Control.SetSRC中出现内存不能为write 遥远的青苹果
    new 与malloc问题 遥远的青苹果
  • 原文地址:https://www.cnblogs.com/cy163/p/1434040.html
Copyright © 2011-2022 走看看