📄 ssh.1
字号:
.It Fl nRedirects stdin from.Pa /dev/null(actually, prevents reading from stdin).This must be used when.Nmis run in the background.A common trick is to use this to run X11 programs on a remote machine.For example,.Ic ssh -n shadows.cs.hut.fi emacs &will start an emacs on shadows.cs.hut.fi, and the X11connection will be automatically forwarded over an encrypted channel.The.Nmprogram will be put in the background.(This does not work if.Nmneeds to ask for a password or passphrase; see also the.Fl foption.).It Fl NDo not execute a remote command.This is useful for just forwarding ports(protocol version 2 only)..It Fl o Ar optionCan be used to give options in the format used in the configuration file.This is useful for specifying options for which there is no separatecommand-line flag..It Fl p Ar portPort to connect to on the remote host.This can be specified on aper-host basis in the configuration file..It Fl PUse a non-privileged port for outgoing connections.This can be used if a firewall doesnot permit connections from privileged ports.Note that this option turns off.Cm RhostsAuthenticationand.Cm RhostsRSAAuthenticationfor older servers..It Fl qQuiet mode.Causes all warning and diagnostic messages to be suppressed..It Fl sMay be used to request invocation of a subsystem on the remote system. Subsystems are a feature of the SSH2 protocol which facilitate the useof SSH as a secure transport for other applications (eg. sftp). Thesubsystem is specified as the remote command..It Fl tForce pseudo-tty allocation.This can be used to execute arbitraryscreen-based programs on a remote machine, which can be very useful,e.g., when implementing menu services.Multiple.Fl toptions force tty allocation, even if.Nmhas no local tty..It Fl TDisable pseudo-tty allocation..It Fl vVerbose mode.Causes.Nmto print debugging messages about its progress.This is helpful indebugging connection, authentication, and configuration problems.Multiple.Fl voptions increases the verbosity.Maximum is 3..It Fl xDisables X11 forwarding..It Fl XEnables X11 forwarding.This can also be specified on a per-host basis in a configuration file..It Fl CRequests compression of all data (including stdin, stdout, stderr, anddata for forwarded X11 and TCP/IP connections).The compression algorithm is the same used by.Xr gzip 1 ,and the.Dq levelcan be controlled by the.Cm CompressionLeveloption.Compression is desirable on modem lines and otherslow connections, but will only slow down things on fast networks.The default value can be set on a host-by-host basis in theconfiguration files; see the.Cm Compressionoption..It Fl F Ar configfileSpecifies an alternative per-user configuration file.If a configuration file is given on the command line,the system-wide configuration file.Pq Pa /etc/ssh/ssh_configwill be ignored.The default for the per-user configuration file is.Pa $HOME/.ssh/config ..It Fl L Ar port:host:hostportSpecifies that the given port on the local (client) host is to beforwarded to the given host and port on the remote side.This works by allocating a socket to listen to.Ar porton the local side, and whenever a connection is made to this port, theconnection is forwarded over the secure channel, and a connection ismade to.Ar hostport.Ar hostportfrom the remote machine.Port forwardings can also be specified in the configuration file.Only root can forward privileged ports.IPv6 addresses can be specified with an alternative syntax:.Ar port/host/hostport.It Fl R Ar port:host:hostportSpecifies that the given port on the remote (server) host is to beforwarded to the given host and port on the local side.This works by allocating a socket to listen to.Ar porton the remote side, and whenever a connection is made to this port, theconnection is forwarded over the secure channel, and a connection ismade to.Ar hostport.Ar hostportfrom the local machine.Port forwardings can also be specified in the configuration file.Privileged ports can be forwarded only whenlogging in as root on the remote machine.IPv6 addresses can be specified with an alternative syntax:.Ar port/host/hostport.It Fl D Ar portSpecifies a local.Dq dynamicapplication-level port forwarding.This works by allocating a socket to listen to.Ar porton the local side, and whenever a connection is made to this port, theconnection is forwarded over the secure channel, and the applicationprotocol is then used to determine where to connect to from theremote machine. Currently the SOCKS4 protocol is supported, and.Nmwill act as a SOCKS4 server.Only root can forward privileged ports.Dynamic port forwardings can also be specified in the configuration file..It Fl 1Forces.Nmto try protocol version 1 only..It Fl 2Forces.Nmto try protocol version 2 only..It Fl 4Forces.Nmto use IPv4 addresses only..It Fl 6Forces.Nmto use IPv6 addresses only..El.Sh CONFIGURATION FILES.Nmmay additionally obtain configuration data froma per-user configuration file and a system-wide configuration file.The file format and configuration options are described in.Xr ssh_config 5 ..Sh ENVIRONMENT.Nmwill normally set the following environment variables:.Bl -tag -width Ds.It Ev DISPLAYThe.Ev DISPLAYvariable indicates the location of the X11 server.It is automatically set by.Nmto point to a value of the form.Dq hostname:nwhere hostname indicatesthe host where the shell runs, and n is an integer >= 1..Nmuses this special value to forward X11 connections over the securechannel.The user should normally not set.Ev DISPLAYexplicitly, as thatwill render the X11 connection insecure (and will require the user tomanually copy any required authorization cookies)..It Ev HOMESet to the path of the user's home directory..It Ev LOGNAMESynonym for.Ev USER ;set for compatibility with systems that use this variable..It Ev MAILSet to the path of the user's mailbox..It Ev PATHSet to the default.Ev PATH ,as specified when compiling.Nm ssh ..It Ev SSH_ASKPASSIf.Nmneeds a passphrase, it will read the passphrase from the currentterminal if it was run from a terminal.If.Nmdoes not have a terminal associated with it but.Ev DISPLAYand.Ev SSH_ASKPASSare set, it will execute the program specified by.Ev SSH_ASKPASSand open an X11 window to read the passphrase.This is particularly useful when calling.Nmfrom a.Pa .Xsessionor related script.(Note that on some machines itmay be necessary to redirect the input from.Pa /dev/nullto make this work.).It Ev SSH_AUTH_SOCKIdentifies the path of a unix-domain socket used to communicate with theagent..It Ev SSH_CLIENTIdentifies the client end of the connection.The variable containsthree space-separated values: client ip-address, client port number,and server port number..It Ev SSH_ORIGINAL_COMMANDThe variable contains the original command line if a forced commandis executed.It can be used to extract the original arguments..It Ev SSH_TTYThis is set to the name of the tty (path to the device) associatedwith the current shell or command.If the current session has no tty,this variable is not set..It Ev TZThe timezone variable is set to indicate the present timezone if itwas set when the daemon was started (i.e., the daemon passes the valueon to new connections)..It Ev USERSet to the name of the user logging in..El.PpAdditionally,.Nmreads.Pa $HOME/.ssh/environment ,and adds lines of the format.Dq VARNAME=valueto the environment..Sh FILES.Bl -tag -width Ds.It Pa $HOME/.ssh/known_hostsRecords host keys for all hosts the user has logged into that are notin.Pa /etc/ssh/ssh_known_hosts .See.Xr sshd 8 ..It Pa $HOME/.ssh/identity, $HOME/.ssh/id_dsa, $HOME/.ssh/id_rsaContains the authentication identity of the user.They are for protocol 1 RSA, protocol 2 DSA, and protocol 2 RSA, respectively.These filescontain sensitive data and should be readable by the user but notaccessible by others (read/write/execute).Note that.Nmignores a private key file if it is accessible by others.It is possible to specify a passphrase whengenerating the key; the passphrase will be used to encrypt thesensitive part of this file using 3DES..It Pa $HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub, $HOME/.ssh/id_rsa.pubContains the public key for authentication (public part of theidentity file in human-readable form).The contents of the.Pa $HOME/.ssh/identity.pubfile should be added to.Pa $HOME/.ssh/authorized_keyson all machineswhere the user wishes to log in using protocol version 1 RSA authentication.The contents of the.Pa $HOME/.ssh/id_dsa.puband.Pa $HOME/.ssh/id_rsa.pubfile should be added to.Pa $HOME/.ssh/authorized_keyson all machineswhere the user wishes to log in using protocol version 2 DSA/RSA authentication.These files are notsensitive and can (but need not) be readable by anyone.These files arenever used automatically and are not necessary; they are only provided forthe convenience of the user..It Pa $HOME/.ssh/configThis is the per-user configuration file.The file format and configuration options are described in.Xr ssh_config 5 ..It Pa $HOME/.ssh/authorized_keysLists the public keys (RSA/DSA) that can be used for logging in as this user.The format of this file is described in the.Xr sshd 8manual page.In the simplest form the format is the same as the .pubidentity files.This file is not highly sensitive, but the recommendedpermissions are read/write for the user, and not accessible by others..It Pa /etc/ssh/ssh_known_hostsSystemwide list of known host keys.This file should be prepared by thesystem administrator to contain the public host keys of all machines in theorganization.This file should be world-readable.This file containspublic keys, one per line, in the following format (fields separatedby spaces): system name, public key and optional comment field.When different names are usedfor the same machine, all such names should be listed, separated bycommas.The format is described on the.Xr sshd 8manual page..PpThe canonical system name (as returned by name servers) is used by.Xr sshd 8to verify the client host when logging in; other names are needed because.Nmdoes not convert the user-supplied name to a canonical name beforechecking the key, because someone with access to the name serverswould then be able to fool host authentication..It Pa /etc/ssh/ssh_configSystemwide configuration file.The file format and configuration options are described in.Xr ssh_config 5 ..It Pa /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_keyThese three files contain the private parts of the host keysand are used for.Cm RhostsRSAAuthenticationand.Cm HostbasedAuthentication .If the protocol version 1.Cm RhostsRSAAuthenticationmethod is used,.Nmmust be setuid root, since the host key is readable only by root.For protocol version 2,.Nmuses.Xr ssh-keysign 8to access the host keys for.Cm HostbasedAuthentication .This eliminates the requirement that.Nmbe setuid root when that authentication method is used.By default.Nmis not setuid root..It Pa $HOME/.rhostsThis file is used in.Pa \&.rhostsauthentication to list thehost/user pairs that are permitted to log in.(Note that this file isalso used by rlogin and rsh, which makes using this file insecure.)Each line of the file contains a host name (in the canonical formreturned by name servers), and then a user name on that host,separated by a space.On some machines this file may need to beworld-readable if the user's home directory is on a NFS partition,because.Xr sshd 8reads it as root.Additionally, this file must be owned by the user,and must not have write permissions for anyone else.The recommendedpermission for most machines is read/write for the user, and notaccessible by others..PpNote that by default.Xr sshd 8will be installed so that it requires successful RSA hostauthentication before permitting \s+2.\s0rhosts authentication.If the server machine does not have the client's host key in.Pa /etc/ssh/ssh_known_hosts ,it can be stored in.Pa $HOME/.ssh/known_hosts .The easiest way to do this is toconnect back to the client from the server machine using ssh; thiswill automatically add the host key to.Pa $HOME/.ssh/known_hosts ..It Pa $HOME/.shostsThis file is used exactly the same way as.Pa \&.rhosts .The purpose forhaving this file is to be able to use rhosts authentication with.Nmwithout permitting login with.Nm rloginor.Xr rsh 1 ..It Pa /etc/hosts.equivThis file is used during.Pa \&.rhosts authentication.It containscanonical hosts names, one per line (the full format is described onthe.Xr sshd 8manual page).If the client host is found in this file, login isautomatically permitted provided client and server user names are thesame.Additionally, successful RSA host authentication is normallyrequired.This file should only be writable by root..It Pa /etc/shosts.equivThis file is processed exactly as.Pa /etc/hosts.equiv .This file may be useful to permit logins using.Nmbut not using rsh/rlogin..It Pa /etc/ssh/sshrcCommands in this file are executed by.Nmwhen the user logs in just before the user's shell (or command) is started.See the.Xr sshd 8manual page for more information..It Pa $HOME/.ssh/rcCommands in this file are executed by.Nmwhen the user logs in just before the user's shell (or command) isstarted.See the.Xr sshd 8manual page for more information..It Pa $HOME/.ssh/environmentContains additional definitions for environment variables, see section.Sx ENVIRONMENTabove..El.Sh DIAGNOSTICS.Nmexits with the exit status of the remote command or with 255if an error occurred..Sh AUTHORSOpenSSH is a derivative of the original and freessh 1.2.12 release by Tatu Ylonen.Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,Theo de Raadt and Dug Songremoved many bugs, re-added newer features andcreated OpenSSH.Markus Friedl contributed the support for SSHprotocol versions 1.5 and 2.0..Sh SEE ALSO.Xr rsh 1 ,.Xr scp 1 ,.Xr sftp 1 ,.Xr ssh-add 1 ,.Xr ssh-agent 1 ,.Xr ssh-keygen 1 ,.Xr telnet 1 ,.Xr ssh_config 4 ,.Xr ssh-keysign 8,.Xr sshd 8.Rs.%A T. Ylonen.%A T. Kivinen.%A M. Saarinen.%A T. Rinne.%A S. Lehtinen.%T "SSH Protocol Architecture".%N draft-ietf-secsh-architecture-12.txt.%D January 2002.%O work in progress material.Re
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -