12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Connecting from the Client 359If the user types yes, the client saves the server’s public RSA key, and the server respondsby requesting the user’s password. If the correct password is entered, the server accepts therequest, and the user receives a shell prompt to the remote system. The server’s public keyis added to the .ssh/known_hosts file in the user’s home directory. After this public key iswritten to this file, the message in Listing 17.2 is no longer displayed when a connectionis requested.When the ssh command is executed, the username of the user currently logged in to theclient is sent to the remote server as the username requesting connection. To use a differentusername on the remote server, use the command ssh username@.Executing a Command RemotelyThe ssh utility also allows users to execute commands remotely using the followingsyntax:ssh If the command contains any wildcards, redirects, or pipes, it must be in quotation markssuch as the following:ssh myserver.example.com “cat /proc/cpuinfo | grep flags”After authenticating with a password or passphrase, the results of are displayedto the client.Transferring Files SecurelyThe scp utility provides the ability to transfer files from one system to another systemrunning an SSH server such as OpenSSH. The command has many variations, but thebasic syntax is as follows:17scp @remote.example.com:Like ssh, if a username is not specified for the remote server, the current username isassumed. If only a directory path is given for , the same filename is used totransfer the file to the specified directory on the remote server.The wildcard character * can be used to specify multiple files for and.The scp command can also be used to transfer remote files to the local system. Justreverse the syntax:scp @remote.example.com: A few command-line options to scp, such as -l, limit the amount of bandwidth it isallowed to use. Refer to its man page with the man scp command for a full list withdescriptions.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!