Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
9.  Using the Network Logging In Remotely (rlogin) Aborting an rlogin Connection  Previous   Contents   Next 
   
 

Suspending an rlogin Connection

When you want to suspend an rlogin connection so you can return to it later, type the tilde character (~) followed by Ctrl-Z. The rlogin connection becomes a stopped process and you are placed back at the machine from which you logged in.

To reactivate the connection, type fg. You can also type the percentage sign (%) followed by the process number of the stopped process. If you do not specify a process number, % activates the process most recently suspended.

venus$ rlogin goddess -l user2
Password:
Last login: Thu Aug 31 14:31:42 from venus
Sun Microsystems Inc.   SunOS 5.9       Generic February 2002
goddess$ pwd
/home/user2
goddess$~^Z

Stopped (user)
venus$ pwd
/home/user2/veggies
venus$fg
rlogin goddess
goddess$ logout
venus$

You can also type two tildes and press Ctrl-Z to suspend the current rlogin and place you at an intermediate rlogin.

For more information on the rlogin(1) command, refer to the man Pages(1): User Commands.

Verifying Your Location (who am i)

After logging in to a variety of remote machines, you might need to verify where you are. Type who am i to display the name of the machine you are currently logged in to as well as your current login name.

Copying Files Remotely (rcp)

The rcp command enables you to copy files from one machine to another. This command uses the remote machine's /etc/hosts.equiv and /etc/passwd files to determine whether you have unchallenged access privileges. The syntax for rcp is similar to the command syntax for cp.


Note - To copy subdirectories and their contents from one machine to another, use rcp -r.


Copying Files From a Remote Machine

To copy from a remote machine to your machine, use the rcp command with the following syntax.

$ rcp machinename:source destination

In the previous example, machinename is the name of the remote machine, source is the name of the file(s) you want to copy, and destination is the path name on your machine where you want the copied file(s) to reside.

The following example illustrates how to copy the file /etc/hosts from the remote machine starbug to the /tmp directory on the local machine venus.

venus$ rcp starbug:/etc/hosts /tmp

You can also combine various abbreviations and syntaxes when using rcp. For example, to copy all of the files ending in .doc from user hank's home directory on remote machine fretful to the current directory on local machine venus, type the following command.

venus$ rcp fretful:~hank/*.doc .
venus$

Copying Files From Your Machine to Another

To copy files from your local machine to a remote machine, use the following command syntax.

$ rcp source machinename:destination

In the previous example, source is the file(s) you want to copy, machinename is the name of the remote machine, and destination is the path name on the remote machine where you want the copied file(s) to reside.

The following example illustrates how to copy the file newhosts from your /tmp directory to the /tmp directory on the remote machine starbug.

venus$ cd /tmp
venus$ rcp newhosts starbug:/tmp
venus$

For more information on the rcp(1) command and its options, refer to the man Pages(1): User Commands.

Executing Commands Remotely (rsh)

The rsh command (for remote shell) enables you to execute a single command on a remote machine without having to log in to the remote machine. If you know you only want to do one thing on a remote machine, rsh enables you to quickly execute one command on a remote machine.

To execute a command on a remote machine, use the following command syntax.

rsh machinename  command 

The following example shows how you would view the contents of the directory /etc/skel on the machine starbug.

venus$ rsh starbug ls /etc/skel*
local.cshrc
local.login
local.profile
venus$ 

Similar to the rlogin and rcp commands, rsh uses the remote machine's /etc/hosts.equiv and /etc/passwd files to determine whether you have unchallenged access privileges to the remote machine.

For more information on the rsh(1) command and its options, refer to the man Pages(1): User Commands.

Viewing User Information (rusers)

The rusers command (for remote users) shows you which users are logged in to other machines on your network. Type the rusers command by itself to display each machine on the network and the user(s) logged in to these machines.

$ rusers
starbug          user2 user1 root
earth            user1
venus					user3

Notice that three users are logged in to the machine starbug.

To display information on a specific remote machine, type the rusers command followed by the name of the machine.

$ rusers starbug
starbug          user2 user1 root
$

The -l option to the rusers command displays the following information.

  • User names

  • Machine and terminal names

  • Time each user logged in

  • How long each user has been idle (if more than one minute)

  • Name of the machine that each user logged in from

$ rusers -l starbug
root       starbug:console       Oct 31 11:19         (:0)
user2      starbug:pts/7         Oct 31 11:20   40:05 (starbug)
user1      starbug:pts/13        Nov  1 14:42   17:18 (starbug)
$

You can also use the -l option without providing a machine name.

For more information on the rusers(1) command and its options, refer to the man Pages(1): User Commands.

 
 
 
  Previous   Contents   Next