📄 using.but
字号:
accidentally output a binary file to your terminal.) If thishappens, selecting Reset Terminal should sort it out.\S2{using-fullscreen} \ii{Full screen} modeIf you find the title bar on a maximised window to be ugly ordistracting, you can select Full Screen mode to maximise PuTTY\q{even more}. When you select this, PuTTY will expand to fill thewhole screen and its borders, title bar and scrollbar willdisappear. (You can configure the scrollbar not to disappear infull-screen mode if you want to keep it; see \k{config-scrollback}.)When you are in full-screen mode, you can still access the systemmenu if you click the left mouse button in the \e{extreme} top leftcorner of the screen.\H{using-logging} Creating a \i{log file} of your \I{sessionlog}sessionFor some purposes you may find you want to log everything thatappears on your screen. You can do this using the \i{\q{Logging}panel} in the configuration box.To begin a session log, select \q{Change Settings} from the systemmenu and go to the Logging panel. Enter a log file name, and selecta logging mode. (You can log all session output including theterminal control sequences, or you can just log the printable text.It depends what you want the log for.) Click \q{Apply} and your logwill be started. Later on, you can go back to the Logging panel andselect \q{Logging turned off completely} to stop logging; then PuTTYwill close the log file and you can safely read it.See \k{config-logging} for more details and options.\H{using-translation} Altering your \i{character set} configurationIf you find that special characters (\i{accented characters}, forexample, or \i{line-drawing characters}) are not being displayedcorrectly in your PuTTY session, it may be that PuTTY is interpretingthe characters sent by the server according to the wrong \e{characterset}. There are a lot of different character sets available, so it'sentirely possible for this to happen.If you click \q{Change Settings} and look at the \i{\q{Translation}panel}, you should see a large number of character sets which you canselect, and other related options. Now all you need is to find outwhich of them you want! (See \k{config-translation} for moreinformation.)\H{using-x-forwarding} Using \i{X11 forwarding} in SSHThe SSH protocol has the ability to securely forward X Window Systemapplications over your encrypted SSH connection, so that you can runan application on the SSH server machine and have it put its windowsup on your local machine without sending any X network traffic inthe clear.In order to use this feature, you will need an X display server foryour Windows machine, such as X-Win32 or Exceed. This will probablyinstall itself as display number 0 on your local machine; if itdoesn't, the manual for the \i{X server} should tell you what itdoes do.You should then tick the \q{Enable X11 forwarding} box in theTunnels panel (see \k{config-ssh-x11}) before starting your SSHsession. The \q{X display location} box is blank by default, whichmeans that PuTTY will try to use a sensible default such as \c{:0},which is the usual display location where your X server will beinstalled. If that needs changing, then change it.Now you should be able to log in to the SSH server as normal. Tocheck that X forwarding has been successfully negotiated duringconnection startup, you can check the PuTTY Event Log (see\k{using-eventlog}). It should say something like this:\c 2001-12-05 17:22:01 Requesting X11 forwarding\c 2001-12-05 17:22:02 X11 forwarding enabledIf the remote system is Unix or Unix-like, you should also be ableto see that the \i{\c{DISPLAY} environment variable} has been set topoint at display 10 or above on the SSH server machine itself:\c fred@unixbox:~$ echo $DISPLAY\c unixbox:10.0If this works, you should then be able to run X applications in theremote session and have them display their windows on your PC.Note that if your PC X server requires authentication to connect,then PuTTY cannot currently support it. If this is a problem foryou, you should mail the PuTTY authors \#{FIXME} and give details(see \k{feedback}).For more options relating to X11 forwarding, see \k{config-ssh-x11}.\H{using-port-forwarding} Using \i{port forwarding} in SSHThe SSH protocol has the ability to forward arbitrary networkconnections over your encrypted SSH connection, to avoid the networktraffic being sent in clear. For example, you could use this toconnect from your home computer to a POP-3 server on a remotemachine without your POP-3 password being visible to networksniffers.In order to use port forwarding to connect from your local machineto a port on a remote server, you need to:\b Choose a port number on your local machine where PuTTY shouldlisten for incoming connections. There are likely to be plenty ofunused port numbers above 3000. (You can also use a local loopbackaddress here; see below for more details.)\b Now, before you start your SSH connection, go to the Tunnelspanel (see \k{config-ssh-portfwd}). Make sure the \q{Local} radiobutton is set. Enter the local port number into the \q{Source port}box. Enter the destination host name and port number into the\q{Destination} box, separated by a colon (for example,\c{popserver.example.com:110} to connect to a POP-3 server).\b Now click the \q{Add} button. The details of your port forwardingshould appear in the list box.Now start your session and log in. (Port forwarding will not beenabled until after you have logged in; otherwise it would be easyto perform completely anonymous network attacks, and gain access toanyone's virtual private network). To check that PuTTY has set upthe port forwarding correctly, you can look at the PuTTY Event Log(see \k{using-eventlog}). It should say something like this:\c 2001-12-05 17:22:10 Local port 3110 forwarding to\c popserver.example.com:110Now if you connect to the source port number on your local PC, youshould find that it answers you exactly as if it were the servicerunning on the destination machine. So in this example, you couldthen configure an e-mail client to use \c{localhost:3110} as a POP-3server instead of \c{popserver.example.com:110}. (Of course, theforwarding will stop happening when your PuTTY session closes down.)You can also forward ports in the other direction: arrange for aparticular port number on the \e{server} machine to be forwardedback to your PC as a connection to a service on your PC or near it.To do this, just select the \q{Remote} radio button instead of the\q{Local} one. The \q{Source port} box will now specify a portnumber on the \e{server} (note that most servers will not allow youto use port numbers under 1024 for this purpose).An alternative way to forward local connections to remote hosts isto use \I{dynamic port forwarding}dynamic \I{SOCKS} proxying. Forthis, you will need to select the \q{Dynamic} radio button insteadof \q{Local}, and then you should not enter anything into the\q{Destination} box (it will be ignored). This will cause PuTTY tolisten on the port you have specified, and provide a SOCKS proxyservice to any programs which connect to that port. So, inparticular, you can forward other PuTTY connections through it bysetting up the Proxy control panel (see \k{config-proxy} fordetails).The source port for a forwarded connection usually does not acceptconnections from any machine except the SSH client or server machineitself (for local and remote forwardings respectively). There arecontrols in the Tunnels panel to change this:\b The \q{Local ports accept connections from other hosts} optionallows you to set up local-to-remote port forwardings (includingdynamic port forwardings) in such a way that machines other thanyour client PC can connect to the forwarded port.\b The \q{Remote ports do the same} option does the same thing forremote-to-local port forwardings (so that machines other than theSSH server machine can connect to the forwarded port.) Note thatthis feature is only available in the SSH 2 protocol, and not allSSH 2 servers honour it (in OpenSSH, for example, it's usuallydisabled by default).You can also specify an \i{IP address} to listen on. Typically aWindows machine can be asked to listen on any single IP address inthe \cw{127.*.*.*} range, and all of these are loopback addressesavailable only to the local machine. So if you forward (for example)\c{127.0.0.5:79} to a remote machine's \cw{finger} port, then youshould be able to run commands such as \c{finger fred@127.0.0.5}.This can be useful if the program connecting to the forwarded portdoesn't allow you to change the port number it uses. This feature isavailable for local-to-remote forwarded ports; SSH1 is unable tosupport it for remote-to-local ports, while SSH2 can support it intheory but servers will not necessarily cooperate.(Note that if you're using Windows XP Service Pack 2, you may needto obtain a fix from Microsoft in order to use addresses like\cw{127.0.0.5} - see \k{faq-alternate-localhost}.)\H{using-rawprot} Making \i{raw TCP connections}A lot of \I{debugging Internet protocols}Internet protocols arecomposed of commands and responses in plain text. For example,\i{SMTP} (the protocol used to transfer e-mail), \i{NNTP} (theprotocol used to transfer Usenet news), and \i{HTTP} (the protocolused to serve Web pages) all consist of commands in readable plaintext.Sometimes it can be useful to connect directly to one of theseservices and speak the protocol \q{by hand}, by typing protocolcommands and watching the responses. On Unix machines, you can dothis using the system's \c{telnet} command to connect to the rightport number. For example, \c{telnet mailserver.example.com 25} mightenable you to talk directly to the SMTP service running on a mailserver.Although the Unix \c{telnet} program provides this functionality,the protocol being used is not really Telnet. Really there is noactual protocol at all; the bytes sent down the connection areexactly the ones you type, and the bytes shown on the screen areexactly the ones sent by the server. Unix \c{telnet} will attempt todetect or guess whether the service it is talking to is a realTelnet service or not; PuTTY prefers to be told for certain.In order to make a debugging connection to a service of this type,you simply select the fourth protocol name, \I{\q{Raw}protocol}\q{Raw}, from the \q{Protocol} buttons in the \q{Session}configuration panel. (See \k{config-hostname}.) You can then enter ahost name and a port number, and make the connection.\H{using-cmdline} The PuTTY command linePuTTY can be made to do various things without user intervention bysupplying \i{command-line arguments} (e.g., from a \i{command promptwindow}, or a \i{Windows shortcut}).\S{using-cmdline-session} Starting a session from the command line\I\c{-ssh}\I\c{-telnet}\I\c{-rlogin}\I\c{-raw}These options allowyou to bypass the configuration window and launch straight into asession.To start a connection to a server called \c{host}:\c putty.exe [-ssh | -telnet | -rlogin | -raw] [user@]hostIf this syntax is used, settings are taken from the Default Settings(see \k{config-saving}); \c{user} overrides these settings ifsupplied. Also, you can specify a protocol, which will override thedefault protocol (see \k{using-cmdline-protocol}).For telnet sessions, the following alternative syntax is supported(this makes PuTTY suitable for use as a URL handler for \i{telnetURLs} in web browsers):\c putty.exe telnet://host[:port]/In order to start an existing saved session called \c{sessionname},use the \c{-load} option (described in \k{using-cmdline-load}).\c putty.exe -load "session name"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -