Innerhalb
Nach weiteren Dokumenten suchenSupport-Ressourcen | Dieses Buch im PDF-Format herunterladen (3405 KB)
Part VII Working With Remote Systems TopicsThis section provides instructions for administering an FTP Server and for accessing remote systems in the Solaris environment. The section contains these chapters.
Chapter 37 Working With Remote Systems (Overview)This section includes information on working with remote files. What Is the FTP Server?The FTP Server is based on wu-ftpd. Originally developed by Washington University in Saint Louis, wu-ftpd is widely used for distribution of bulk data over the Internet and is the preferred standard for large FTP sites. For information on the licensing terms, refer to the materials that are incorporated at /var/sadm/pkg/SUNWftpu/install/copyright. What Is a Remote System?For the purpose of this chapter, a remote system is a workstation or server that is connected to the local system with any type of physical network and configured for TCP/IP communication. On systems running the Solaris 9 release, TCP/IP configuration is established automatically during startup. For more information, see System Administration Guide: IP Services. What's New for the Solaris 9 FTP Server?The FTP Server is compatible with Solaris 8 FTP software, yet offers new capability with improved performance for Solaris 9 users. Table 37–1 What's New for the Solaris 9 FTP Server
Note – The Solaris 8 /etc/default/ftpd is not supported in the Solaris 9 release. During upgrade, BANNER and UMASK entries are converted to their wu-ftpd equivalents. However, the system administrator might need to manually convert some BANNER lines for the equivalent ftpaccess greeting capability. For further information, see ftpaccess(4). Note – The sublogin feature that is provided by the Solaris 8 FTP Server is not supported by the Solaris 9 FTP Server. Chapter 38 Administering the FTP Server (Tasks)This chapter includes tasks that are described in the following table to set up and administer an FTP server. Table 38–1 Task Map: Administering the FTP Server
Controlling FTP Server AccessYou can use the following configuration files in the /etc/ftpd directory to control access to the FTP server.
How to Define FTP Server ClassesTo log in to the FTP server, users must be members of a class when the ftpaccess file is used. To add the class directive to the ftpaccess file, you specify the class name, typelist of users who are permitted access from a particular host.
Example—Defining FTP Server Classes
The previous example defines the local class as any user of the type real, guest, or anonymous who logs in from *.provider.com. The last line defines remote as any user who logs in from anywhere other than *.provider.com. How to Set User Login LimitsYou can limit the number of simultaneous logins by users of a certain class with directives that are set in the ftpaccess file. Each login limit contains the name of a class, a UUCP-style days-of-week list, and a message file to display if the limit is exceeded. To set user login limits, follow the steps in the next procedure.
Example—Setting User Login Limits
The first line of the preceding example shows a limit of 50 simultaneous logins that are allowed to users of class anon during weekly work hours. The second line limits anon users to 100 simultaneous logins outside of working hours. The last line shows a limit of 100 guest logins that are allowed at any time. For information on how to specify day and time parameters, see ftpaccess(4). The example further indicates that the content of the file /etc/ftpd/ftpmsg.deny is returned when a specified login limit is reached, assuming ftpmsg.deny exists. For information on using the /usr/sbin/ftpcount command to view the number and login limit for each class of user who is logged in at a particular time, see ftpcount(1). Users are allowed login to the FTP server unless a specified limit is reached. Anonymous users are logged in as the user ftp. Real users are logged in as themselves, and guests are logged in as real users with a chroot environment to limit access privileges. For information on using the /usr/sbin/ftpwho command to check the identities of the users logged into the FTP server, see ftpwho(1). How to Control the Number of Invalid Login AttemptsIf a login to the FTP server fails because of a problem such as misspelling required information, login is usually repeated. The user is allowed a specific number of consecutive login attempts before a message is logged to the syslog file. At that point, the user is disconnected. You can set a failure limit on the number of login attempts by following steps in the next procedure.
Example—Controlling the Number of Invalid Login Attempts
The preceding example states that the user is disconnected from the FTP server after 10 failed login attempts. How to Disallow FTP Server Access to Particular UsersThe /etc/ftpd/ftpusers file lists names of users who are not allowed to log in to the FTP server. When login is attempted, the FTP server checks the /etc/ftpd/ftpusers file to determine whether the user should be denied access. If the user's name is not found in that file, the server then searches the /etc/ftpusers file. If the user's name is matched in /etc/ftpusers, a syslogd message is written with a statement that the match was found in a deprecated file. The message also recommends the use of /etc/ftpd/ftpusers instead of /etc/ftpusers. Note – Support for the /etc/ftpusers file has been deprecated in this release. If the /etc/ftpusers file exists when the FTP server is installed, the file is moved to /etc/ftpd/ftpusers. For additional information, see syslogd(1M), in.ftpd(1M), and ftpusers(4)
Example—How to Disallow FTP Server Access
The previous example lists the typical entries in the ftpusers file. User names match entries in the /etc/passwd. The list generally includes the superuser root and other administrative and system application identities. The root entry is included in the ftpusers file as a security measure. The default security policy is to disallow remote logins for root. The policy is also followed for the default value that is set as the CONSOLE entry in the /etc/default/loginfile. See login(1). How to Restrict Access to the Default FTP ServerIn addition to the controls mentioned previously, you can add explicit statements to the ftpaccess file to restrict access to the FTP server.
Example—Restricting Access to the Default FTP Server
The previous example states that the FTP server denies access to all users except anon users and those users who are listed on the allow line. You can also use the ftphosts file to deny access to particular login accounts from various hosts. See ftphosts(4) for additional information. Setting Up FTP Server LoginsTo access an FTP server, you must first log in. The FTP server supports three types of user login accounts for real, guests, and anonymous users.
How to Set Up Real FTP UsersTo enable access for real users to the FTP server, follow these instructions:
How to Set Up Guest FTP UsersThe ftpconfig script is used to copy all necessary system files to the home directory. When the guest user and the guest's home directory already exist, the ftpconfig script updates the area with the current system files. For more information, see ftpconfig(1M) Note – Unlike the user name (anonymous or ftp) that is set for anonymous users, user names for FTP guests are not fixed. Any name that would work as a real user name can be selected. To enable access by a guest user to the FTP server, do the following:
Example—Setting Up a Guest FTP ServerIn this example, the FTP area is set up in the /home/guests directory.
How to Set Up Anonymous FTP UsersThe ftpconfig script creates the anonymous user account and populates the home directory with the required files. For more information, see ftpconfig(1M). To enable access by an anonymous user to the FTP server, follow these instructions:
Example—Setting Up Anonymous FTP UsersIn this example, the FTP area is set up in the /home/ftp directory.
How to Create the /etc/shells file
Example—Creating the /etc/shells fileThe following is an example of an /etc/shells file with a /bin/true listed for FTP guest users:
Customizing Message FilesYou can configure the FTP server to return messages that are related to specific events to the FTP client. A welcome message might be set to display when a user logs in to the FTP server. Another message could appear when the user makes a directory change. In addition to plain text, message files can contain one or more magic cookies. A magic cookie is composed of a % (percent sign), followed by a single character. When you embed a cookie in message text, information that is associated with the cookie appears on screen at the point the message file is called. For example, message text might contain the cookie %L:
When the message is displayed, the magic cookie %L is replaced with the name of the server as defined by the hostname statement in the ftpaccess file. For a complete list of supported message cookies, see ftpaccess(4). Note – If the host name is not defined in the ftpaccess file, the default host name for the local machine is used. How to Customize Message Files
Example—Customizing Message FilesThe following is an example of a message file that includes magic cookies:
How to Create Messages to Be Sent to UsersAfter the user is logged in, system-related or application-related messages are displayed on screen. The ftpaccess file lists the events that trigger associated message statements.
Example: How to Create Messages to Be Sent to Users
The preceding example states that the file /etc/ftpd/Welcome is displayed at login for users of the class anon or guest. The second line states that the .message file in the current working directory is displayed for all users. Message files are created relative to the chroot directory for guest and anonymous users. How to Configure the README OptionThe first time a directory is visited, README files can be listed. To configure the README option, add the following entries to the ftpaccess file.
Example—Configuring the README Option
The previous example states that any files that match README* are listed at login or when a directory is changed. Here is a sample login that is based on the settings that are used in that example.
Controlling Access to Files on the FTP ServerThe FTP server access controls in this section supplement the standard file and directory access controls available with the Solaris 9 operating environment. Use the standard Solaris commands to restrict who can access, change, or upload files. See chmod(1), chown(1), and chgrp(1). How to Control File Access CommandsTo use the permission capabilities in ftpaccess to specify what type of user is allowed to perform which commands, do the following:
Example—How to Control File Access CommandsThe following are examples of permissions that are set for file access functions on FTP server.
The preceding example states the following:
Controlling Uploads and Downloads on the FTP ServerYou can control uploads and downloads that are started to and from the FTP server by setting permissions on directories on the server. By default, uploads are not allowed for anonymous users. Be very careful when enabling anonymous uploads. How to Control Uploads to the FTP ServerAdd the directives to the ftpaccess file to specify upload permissions and error messages for upload failures.
Example—Controlling Uploads to the FTP Server
The preceding example states the following:
Note – Ownership and permissions on a directory into which anonymous uploads are allowed should be tightly controlled. The FTP Administrator should be the owner of all files uploaded to the FTP server. You need to create an FTP Administrator when anonymous users are allowed to upload files. The directory should be owned by the user ftpadm and group ftpadm with permissions set to 3773. The access mode for files uploaded to the FTP server should be 0440. The 0440 mode prevents the anonymous account from reading uploaded files. This restriction protects your server from becoming a staging area for third-party file distribution. To make uploaded files available for distribution, the FTP Administrator can move files to a public directory. How to Control Downloads to the FTP Server
Example—Controlling Downloads to the FTP Server
The preceding example states that all users are prevented from retrieving the /etc/passwd file. Virtual HostingVirtual hosting allows the FTP server to support multiple domains on the same machine. Each virtual host requires a separate logical interface and IP address. The FTP server supports two types of virtual hosting: limited and complete. With limited virtual hosting, the same configuration files are used for all virtual hosts. With complete virtual hosting, separate configuration files can be used for each virtual host. Note – By default, real and guest users are not allowed to log in to virtual hosts. You can set the following ftpaccess directives to override the default.
See ftpaccess(4) for further information. How to Enable Limited Virtual HostingLimited virtual hosting provides partial support for virtual FTP servers. You can enable support for limited virtual hosting by specifying the virtual root directory. If required, you can also set the following parameters for the virtual host in the ftpaccess file:
Example—Enabling Limited Virtual Hosting
The preceding example sets the location of the root directory, banner, and logfile on a virtual FTP server. Note – The ftpaddhost(1M) script with the -l option is provided to configure limited virtual hosts. In the following example, ftpaddhost is run with -l -b -x options to configure limited virtual hosting with a test banner and the logfile /var/ftp/virtual/10.1.2.3/xferlog under a virtual root /var/ftp/virtual/10.1.2.3.
How to Enable Complete Virtual HostingComplete virtual hosting allows separate configuration files for each virtual domain. To enable complete support for virtual hosting on the FTP server, you can create or modify the following FTP configuration files for specific domains:
For further information, see ftpaccess(4), ftpusers(4), ftpgroups(4), ftphosts(4), and ftpconversions(4). Note – If separate versions of the configuration files are unavailable, master versions of the files in the /etc/ftpd directory are used.
Example—Enabling Complete Virtual Hosting
The preceding example specifies the IP addresses for two different domains on the virtual server. Note – The ftpaddhost(1M) script with the -c option is provided to configure complete virtual hosts. In the following example, ftpaddhost is run with -l -b -x options to configure limited virtual hosting with a test banner and the logfile /var/ftp/virtual/10.1.2.3/xferlog under a virtual root /var/ftp/virtual/10.1.2.3.
Starting the FTP Server AutomaticallyThe FTP server can be started in one of two ways:
Starting an FTP Server From inetd.confYou can add a nowait entry in inetd.conf file to start the FTP server. If the site handles many connections, the FTP daemon can also be run in standalone mode. For more information, see inetd.conf(4). See also in.ftpd(1M) for information on additional command-line options. How to Start an FTP Server From inetd.conf
Starting a Standalone FTP ServerThe FTP server can also be run independently of the inetd.conf as a standalone server. A standalone server always has the quickest possible response time, and is intended for large servers that are dedicated to providing FTP service. The standalone server provides low connection latency for dedicated servers because the standalone system never has to be restarted. The standalone server is always running—even during off-peak hours—waiting indefinitely for connections. How to Start a Standalone FTP Server
Shutting Down the FTP ServerThe ftpshut(1M) command closes down the FTP server at a particular time. When you run ftpshut, a file is generated from command-line options that specify when shutdown occurs, the point at which new connections are refused, and when existing connections are dropped. Users are notified of a server shutdown based on this information. The location of the file that is created by ftpshut is specified by the shutdown directive in the ftpaccess file. How to Shut Down the FTP ServerFollow the steps in this procedure to run ftpshut and to add the shutdown directive to the ftpaccess file.
Debugging the FTP ServerThis section describes some of the ways to debug problems with the FTP server. How to Check syslogd for FTP Server MessagesThe FTP server writes messages that are useful for debugging to the location that is specified for daemon messages in the /etc/syslog.conf file. If a problem occurs with the FTP server, check this file first for such messages. The FTP server messages are controlled by facility daemon and level information. To send messages from the FTP server to /var/adm/message and have syslogd reread its configuration file, follow these instructions:
How to Use greeting text to Verify ftpaccessTo use the greeting text capability to check that the correct ftpaccess file is being used, do the following:
How to Check the Commands Executed by FTP UsersTo see what commands are being executed by FTP users, use the log commands logging capability in ftpaccess.
Chapter 39 Accessing Remote Systems (Tasks)This chapter describes all the tasks that are required to log in to remote systems and work with their files. This is a list of the step-by-step instructions in this chapter. This chapter provides tasks that are described in the following table to log in and copy files from remote systems. Table 39–1 Task Map: Accessing Remote Systems
Logging In to a Remote System (rlogin)The rlogin command enables you to log in to a remote system. After you are logged in, you can navigate through the remote file system and manipulate its contents (subject to authorization), copy files, or execute remote commands. If the system you are logging in to is in a remote domain, be sure to append the domain name to the system name. In this example, SOLAR is the name of the remote domain: rlogin pluto.SOLAR Also, you can interrupt a remote login operation at any time by typing Control-d. Authentication for Remote Logins (rlogin)Authentication (establishing who you are) for rlogin operations can be performed either by the remote system or by the network environment. The main difference between these forms of authentication lies in the type of interaction they require from you and the way they are established. If a remote system tries to authenticate you, you are prompted for a password, unless you set up the /etc/hosts.equiv or .rhosts file. If the network tries to authenticate you, you are not asked for a password, because the network already knows who you are. When the remote system attempts to authenticate you, it relies on information in its local files, specifically if one of the following is true:
Network authentication relies on one of these two methods:
Note – Network authentication generally supersedes system authentication. /etc/hosts.equiv FileThe /etc/hosts.equiv file contains a list of trusted hosts for a remote system, one per line. If a user attempts to log in remotely (using rlogin) from one of the hosts that is listed in this file, and if the remote system can access the user's password entry, the remote system allows the user to log in without a password. A typical hosts.equiv file has the following structure:
When a simple entry for a host is made in hosts.equiv, such as the previous entry for host1, it means that the host is trusted, and so is any user at that machine. If the user name is also mentioned, as in the second entry in the example, then the host is trusted only if the specified user is attempting access. A group name that is preceded by a plus sign (+) means that all the machines in that netgroup are considered trusted. A group name that is preceded by a minus sign (–) means that none of the machines in that netgroup is considered trusted. Security Risks When Using the /etc/hosts.equiv FileThe /etc/hosts.equiv file presents a security risk. If you maintain a /etc/hosts.equiv file on your system, you should include only trusted hosts in your network. The file should not include any host that belongs to a different network, or any machines that are in public areas. For example, do not include a host that is located in a terminal room. The use of hosts that are not trusted can create a serious security problem. Either replace the /etc/hosts.equiv file with a correctly configured one, or remove the file altogether. A single line of + in the /etc/hosts.equiv file indicates that every known host is trusted. .rhosts FileThe .rhosts file is the user equivalent of the /etc/hosts.equiv file. This file contains a list of host-user combinations, rather than hosts in general. If a host-user combination is listed in this file, the specified user is granted permission to log in remotely from the specified host without having to supply a password. Note that a .rhosts file must reside at the top level of a user's home directory. .rhost files that are located in subdirectories are not consulted. Users can create .rhosts files in their home directories. Using the .rhosts file is another way to allow trusted access between users' own accounts on different systems without using the /etc/hosts.equiv file. Security Risks When Using the .rhosts FileUnfortunately, the .rhosts file presents a major security problem. While the /etc/hosts.equiv file is under the system administrator's control and can be managed effectively, any user can create a .rhosts file that grants access to whomever the user chooses without the system administrator's knowledge. In a situation in which all of the users' home directories are on a single server and only certain people have superuser access on that server, a good way to prevent a user from using a .rhosts file is to create an empty file as superuser in their home directory. You would then change the permissions in this file to 000 so that it would be difficult to change it, even as superuser. This change would effectively prevent a user from risking system security by using a .rhosts file irresponsibly. The change would not, however, solve anything if the user is able to change the effective path to his or her home directory. The only secure way to manage .rhosts files is to completely disallow them. See How to Search for and Remove .rhosts Files for detailed instructions. As system administrator, you can check the system often for violations of this policy. One possible exception to this policy is for the root account—you might need to have a .rhosts file to perform network backups and other remote services. Linking Remote LoginsIf your system is configured properly, you can link remote logins. For example, a user on earth logs in to jupiter, and from there decides to log in to pluto. The user could have logged out of jupiter and then logged in directly to pluto, but this type of linking can be more convenient. To link remote logins without having to supply a password, you must have the /etc/hosts.equiv or .rhosts file set up correctly. Direct or Indirect Remote LoginsThe rlogin command allows you to log in to a remote system directly or indirectly. A direct remote login is attempted with the default user name, that is, the user name of the individual who is currently logged in to the local system. This is the most common form of remote login. An indirect remote login is attempted with a different user name, which is supplied during the remote login operation. This is the type of remote login you might attempt from a workstation that you borrowed temporarily. For instance, if you were in a coworker's office and needed to examine files in your home directory, you might log in to your system remotely, from your coworker's system. However, you would perform an indirect remote login, supplying your own user name. The dependencies between direct and indirect logins and authentication methods are summarized in the following table. Table 39–2 Dependencies Between Login Method and Authentication Method (rlogin)
What Happens After You Log In RemotelyWhen you log in to a remote system, the rlogin command attempts to find your home directory. If the rlogin command can't find your home directory, it assigns you to the remote system's root (/) directory. For example:
However, if the rlogin command finds your home directory, it sources both your .cshrc and .login files. Therefore, after a remote login, your prompt is your standard login prompt, and the current directory is the same as when you log in locally. For example, if your usual prompt displays your system name and working directory, and when you log in, your working directory is your home directory, your login prompt resembles the following:
Then when you log in to a remote system, you see a similar prompt and your working directory is your home directory, regardless of the directory from which you entered the rlogin command:
The only difference is that the name of the remote system would substitute for your local system at the beginning of the prompt. The remote file system is parallel to your home directory. Effectively, if you change directory to /home and then run ls, you see the following:
How to Search for and Remove .rhosts Files
Example—Searching for and Removing .rhosts FilesThe following example searches and removes .rhosts files in all the user's home directories that are located in the /export/home directory.
How to Find Out If a Remote System Is OperatingFind out if a remote system is operating by using the ping command.
The ping command returns one of three messages:
If the system you “ping” is located in a different domain, the return message can also contain routing information, which you can ignore. The ping command has a timeout of 20 seconds. Effectively, if it does not receive a response within 20 seconds, it returns the third message. You can force ping to wait longer (or less) by typing a time-out value, in seconds:
For more information, see ping(1M). How to Find Who Is Logged In to a Remote SystemFind who is logged in to a remote system by using the rusers(1) command.
Example—Finding Who Is Logged In to a Remote SystemThe following example shows the short output of rusers.
In the following example, the long version of rusers shows that two users are logged in to the remote system starbug. The first user logged in from the system console on September 10 and has been logged on for 137 hours and 15 minutes. The second user logged in from a remote system, mars, on September 14.
How to Log In to a Remote System (rlogin)Log in to a remote system by using the rlogin(1) command.
If the network attempts to authenticate you, you are not prompted for a password. If the remote system attempts to authenticate you, you are asked to provide a password. If the operation succeeds, the rlogin command displays brief information about your latest remote login to that system, the version of the operating system that is running on the remote system, and whether you have mail waiting for you in your home directory. Example—Logging In to a Remote System (rlogin)The following example shows the output of a direct remote login to pluto. The user has been authenticated by the network.
The following example shows the output of an indirect remote login to pluto, with the user being authenticated by the remote system.
How to Log Out From a Remote System (exit)Log out from a remote system by using the exit(1) command.
Example—Logging Out From a Remote System (exit)This example shows the user smith logging out from the system pluto.
Logging In to a Remote System (ftp)The ftp command opens the user interface to the Internet's File Transfer Protocol. This user interface, called the command interpreter, enables you to log in to a remote system and perform a variety of operations with its file system. The principal operations are summarized in the following table. The main benefit of ftp over rlogin and rcp is that ftp does not require the remote system to be running UNIX. The remote system does, however, need to be configured for TCP/IP communications. However, rlogin provides access to a richer set of file manipulation commands than ftp provides. Authentication for Remote Logins (ftp)Authentication for ftp remote login operations can be established by one of the following methods:
Essential ftp CommandsTable 39–3 Essential ftp Commands
For more information, see ftp(1). How to Open an ftp Connection to a Remote System
Example—Opening an ftp Connection to a Remote SystemThis ftp session was established by the user smith on the remote system pluto:
How to Close an ftp Connection to a Remote SystemClose an ftp connection to a remote system by using the bye command.
A goodbye message appears, followed by your usual shell prompt. How to Copy Files From a Remote System (ftp)
Examples—Copying Files From a Remote System (ftp)In this example, the user kryten opens an ftp connection to the system pluto, and uses the get command to copy a single file from the /tmp directory.
In this example, the same user kryten uses the mget command to copy a set of files from the /tmp directory to his home directory. Note that kryten can accept or reject individual files in the set.
How to Copy Files to a Remote System (ftp)
Examples—Copying Files to a Remote System (ftp)In this example, the user kryten opens an ftp connection to the system pluto, and uses the put command to copy a file from his or her system to the /tmp directory on system pluto.
In this example, the same user kryten uses the mput command to copy a set of files from his or her home directory to pluto's /tmp directory. Note that kryten can accept or reject individual files in the set.
Remote Copying With rcpThe rcp command copies files or directories between a local and a remote system or between two remote systems. You can use this command from a remote system (after logging in with the rlogin command) or from the local system (without logging in to a remote system). With rcp, you can perform the following remote copy operations:
If you have the automounter running, you can perform these remote operations with the cp command. However, the range of cp is constrained to the virtual file system that is created by the automounter and to operations relative to a user's home directory. Because rcp performs the same operations without these constraints, this section describes only the rcp versions of these tasks. Security Considerations for Copy OperationsTo copy files or directories between systems, you must have permission to log in and copy files. Both the cp and rcp commands can overwrite files without warning. Ensure that file names are correct before executing the command. Specifying Source and TargetWith the rcp command in the C shell, you can specify source (the file or directory you want to copy) and target (the location into which you will copy the file or directory) with either absolute or abbreviated path names.
Absolute path names identify files or directories that are mounted on a particular system. In the previous example, the first absolute path name identifies a file (MyFile.txt) on the mars system. Abbreviated path names identify files or directories relative to a user's home directory, wherever it might reside. In the previous first example, the abbreviated path name identifies the same file, MyFile.txt, but uses “~” symbol to indicate the jones home directory: ~ = mars:/home/jones The examples on the second line demonstrate the user of absolute and abbreviated path names after a remote login. No difference is evident for the abbreviated path name. However, because the remote login operation mounted the jones home directory onto the local system (parallel to the local user's home directory), the absolute path name no longer requires the system name mars. For more information about how a remote login operation mounts another user's home directory, see What Happens After You Log In Remotely. The following table provides a sample of absolute and abbreviated path names that are recognized by the C shell. The sample uses the following terminology:
How to Copy Files Between a Local and a Remote System (rcp)
Examples—Copying Files Between a Local and a Remote System (rcp)Here are several examples of using rcp to copy files to and from local and remote systems. Using rcp to Copy a Remote File to a Local SystemIn this example, rcp is used to copy the file letter.doc from the /home/jones directory of the remote system pluto to the working directory (/home/smith) on the local system, earth:
In this instance, the rcp operation is performed without a remote login. Here, the “.” symbol at the end of the command line refers to the local system, not the remote system. The target directory is the also local user's home directory, so it can also be specified with the “~” symbol.
Using rlogin and rcp to Copy a Remote File to a Local SystemIn this example, the rcp operation is run after the rlogin command is executed to copy a file from a remote to a local system. Although the flow of the operation is the same as that of the previous example, the paths change to allow for the remote login:
Using the “.” symbol at the end of the command line would be inappropriate in this instance. Because of the remote login, the symbol would simply refer to the remote system—essentially directing rcp to create a duplicate file. The “~” symbol, however, refers to the current user's home directory, even when the login is to a remote system. Using rcp to Copy a Local File to a Remote SystemIn this example, rcp is used to copy the file notice.doc from the home directory (/home/smith) of the local system earth to the /home/jones directory of the remote system, pluto:
Because no remote file name is provided, the file notice.doc is copied into the /home/jones directory with the same name. In this instance, the rcp operation from the previous example is repeated, but rcp is entered from a different working directory on the local system (/tmp). Note the use of the “~” symbol to refer to the current user's home directory:
Using rlogin and rcp to Copy a Local File to a Remote SystemIn this example, the rcp operation is run after the rlogin command is executed to copy a local file to a remote directory. Although the flow of the operation is the same as that of the previous example, the paths change to allow for the remote login.
In this instance, the “~” symbol can be used to denote the current user's home directory, even though it is on the local system. The “.” symbol refers to the working directory on the remote system because the user is logged in to the remote system. Here is an alternative syntax that performs the same operation:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||