-->
Previous | Table of Contents | Next |
The rsh command, an abbreviation for remote shell, starts a shell on the specified remote host and executes the command, if any, that you specify on the rsh command line. If you dont give a command to execute, youre logged in to the remote machine by using rlogin.
The syntax of the rsh command is as follows:
rsh [-Kdnx] [-k realm] [-l user-name] hostname [ command]
However, the most common usage is this:
rsh hostname [command]
The command argument can be virtually any Linux command that can be entered from the shell prompt. Table 30.4 explains the command-line options for rsh.
Option | Description |
---|---|
-K | Turns off all Kerberos authentication. Its used only when connecting to a host that uses Kerberos. |
-d | Turns on socket debugging on the TCP sockets used for communication with the remote host. See the setsockopt man page for more information. |
-k | Requests rsh to obtain Kerberos tickets for the remote host in the specified realm instead of the remote hosts realm as determined by krb_realmofhost(3). |
-l | Allows the remote name to be specified. If available, Kerberos authentication is used, and authorization is determined as with the rlogin command. |
-n | Redirects input from the special device /dev/null. |
-x | Turns on DES encryption for all data passed. This can affect response time and CPU usage, but it provides increased security. |
Linux takes the standard input to the rsh command and copies it to the standard input of the remotely executed command. It copies the standard output of the remote command to standard output for rsh. It also copies the remote standard error to the local standard error file descriptor. Any quit, terminate, and interrupt signals are sent to the remote command. Also, any special shell characters that arent enclosed with quotation marks, as in >>, are handled locally. If enclosed with quotation marks, these characters are handled by the remote command.
The rcp command, which stands for remote copy, is the last of the r- commands that you need to know. Its used to copy files between computers. You can use rcp to copy files from one remote computer to another, without either the source or destination being on the local machine.
The rcp command has two forms. The first form is used to copy a file to a file. The second form is used when copying files or a directory to a directory. The syntax for the rcp command can be either of the following:
rcp [-px] [-k realm] filename1 filename2 rcp [-px] [-r] [-k realm] file(s) directory
Each file or directory argument is either a remote filename or a local filename. Remote filenames have the form rname@rhost:path, where rname is the remote username, rhost is the remote computer, and path is the path to the file. The filename must contain a colon.
Table 30.5 explains the arguments for rcp.
Option | Description |
---|---|
-r | Recursively copies the source directory tree into the destination directory. To use this option, the destination must be a directory. |
-p | Tries to preserve the modification times and modes of the source files, ignoring the umask. |
-k | Requests rcp to obtain Kerberos tickets for the remote host in the specified realm instead of the remote hosts realm, as determined by krb_realmofhost(3). |
-x | Turns on DES encryption for all data passed by rcp. This can affect response time and CPU usage but provides increased security. |
If the path specified in the filename isnt a full path name, its interpreted as being relative to the login directory of the specified user on the remote computer. If no remote username is given, your current username is used. If a path on a remote host contains special shell characters, it can be quoted by using \, , or as appropriate. This causes all the shell metacharacters to be interpreted remotely.
NOTE: rcp doesnt prompt for passwords. It performs its copies via the rsh command.
Previous | Table of Contents | Next |