OpenSSH Is A Suite of Secure Network Tool
OpenSSH Is A Suite of Secure Network Tool
Ssh,scp,sftp-port 22
Highlight p. 676
securely copy a file to or from a remote system, the following criteria must be met:
The remote system must be running the OpenSSH daemon (sshd), you must have
an account on the remote system, and the server must positively identify itself to
the client. ssh
The following example shows Zach using ssh to log in on the
remote host named plum, running who, and finally giving an exit command to
return to the shell on the local sys- tem. The who utility displays the IP address of
the system Zach logged in from.
$ ssh zach@plum
zach@plums password: [zach@plum ~]$ who am i zach
pts/2 2010-12-03 11:43 (172.16.192.150) [zach@plum ~]$ exit logout Connection
to plum closed. You can omit user@ (zach@ in the preceding example) from the
command line if you want to log in as yourself and you have the same username on
both systems. The first time you connect to a remote OpenSSH server, ssh or scp
asks you to confirm that you are connected to the right system. Refer to First-time
authentication on page 679. scp
The following example uses scp to copy ty1 from the working directory on the local
system to Zachs home directory on plum:
$ scp ty1 zach@plum:
zach@plum's password: ty1
100% 162 0.2KB/s 00:00
allows a user to log in as a privileged user by suppling the root password. This setup
allows the root password to be sent over the network, although it is encrypted, so it
is not a big security risk. It also requires all users con- necting as a privileged user
to know the root password.
Setting this declaration to no does not allow root to authenticate directly;
privilege must come from sudo or su after a user has logged in. Given the number
of brute- force attacks on a typical system connected to the Internet, this is a good
choice. Setting this declaration to without-password means the only way for a user
to authenticate as root is by using an authorized key (page 689). This choice
eliminates the need for a group of people to know the root password. However, one
user must be able to run with root privileges so new keys can be added as needed.
Setting this declaration to forced-commands works with an authorized key but
forces a specific command after authentication instead of starting an interactive
shell.
The command is specified by ForceCommand (page 693).
PermitUserEnvironment yes | no Permits a user to modify the environment
he logs in to on the remote system. Default is no. See environment on page 676.
Port num Specifies that the sshd server listen on port num. It might improve
security to change num to a nonstandard port. Default is 22.
StrictModes yes | no Checks modes and ownership of the users home
directory and files. Login fails for users other than the owner if the directories
and/or files can be written to by anyone other than the owner. For a more
secure system, set this declaration to yes. Default is yes. SyslogFacility val
Specifies the facility name (page 624) sshd uses when logging messages. Set
val to daemon, user, auth, authpriv, local0, local1, local2, local3, local4,
local5, local6, or local7. Default is auth.
TCPKeepAlive yes | no Periodically checks whether a connection is
alive when set to yes. Checking causes the ssh or scp connection to be
dropped when the client crashes or the connection dies for another reason,
even if it is only temporary. Setting this parameter to no causes the server
not to check whether the connection is alive. Default is yes.
X11Forwarding yes | no Allows X11 forwarding when set to yes. For
trusted X11 forwarding to work, the ForwardX11 or the ForwardX11Trusted
declaration must also be set to yes in either the ~/.ssh/config or
/etc/ssh/ssh_config client configuration file (page 686).