Linux offers a rich set of protocols you can use to copy files between
computers. Which protocol you use depends on how much work you want to
invest and whether you need to be compatible with future Windows
installations. The following sections feature various methods to transfer
files from and to Linux computers. Make sure to have a working network
connection, otherwise they will not work. All scenarios rely on a working name resolution in the
network. If your network does not include a name service, use IP
addresses directly or add the IP addresses along with respective hostnames
/etc/hosts on all clients.
The following example IP addresses and hostnames are used across this section:
The following requirements must be met on both server and client:
Make sure hostnames of IP addresses of both server and client are
known across the network. Each hostname needs to be listed in
/etc/hosts, for both server and client (see Section “
” (Chapter 21, Basic Networking, ↑Reference).)
If you use a firewall, open the SSH port. Start YaST, and select+ . Go to and check, whether is displayed as part of the list. If this is not the case, select SSH from and click . Apply your changes and leave YaST with and .
To copy files from a server to a client, you need to know where the
files are located on the server. For example, to copy a single file
/srv/foo_file from the server to the current
directory, use the scp command (do not forget the
scp email@example.com:/foo_file .
To copy a whole directory structure, use the recursive mode of scp:
scp -r firstname.lastname@example.org:/foo_directory .
If your network does not provide name resolution, use the server's IP address directly:
scp email@example.com:/foo_file .
If you do not know exactly where your files are, use the sftp command. Refer to Section 22.214.171.124: Using the sftp Protocol or see man sftp.
Copying files in KDE or GNOME with SFTP is very simple. Proceed as follows:
Enter the following at the address prompt:
Enter your the password of
Drag and drop your server files or directories to your desktop or a local directory.
KDE provides another protocol called
fish that can
be used if
sftp is not available. The usage of this
protocol is similar to
sftp, just replace the
sftp protocol prefix of the URL by
Before using rsync to synchronize file and directories between different computers, make sure the following requirements are met:
rsync is installed.
Identical users are available on both systems.
Enough disk space is available on the server.
If you want to benefit from rsync's full potential, make sure rsyncd is installed on one of the systems.
rsync is useful for archiving or copying data. You only need a remote shell (such as ssh) on the target system. rsync can also be used as a daemon to provide directories to the network (see Advanced Setup for rsync Synchronization).
The basic mode of operation of rsync does not require any special configuration. rsync allows mirroring of complete directories onto another system out of the box. Its usage is not much different from a regular copying tool, such as scp. The following command creates a backup of the home directory of tux on a backup server called sun:
rsync -Hbaz -e ssh /home/tux/ tux@sun:backup
Use the following command to apply your backup:
rsync -Haz -e ssh tux@sun:backup /home/tux/
Start the rsyncd daemon on one of your systems to make use of the full functionality of rsync. In this mode it is possible to create synchronization points (modules) that can be accessed without account. To use the rsyncd daemon, proceed as follows:
Procedure 11.1. Advanced Setup for rsync Synchronization
Log in as
root and install the
Configure your “synchronization points”:
gid = nobody uid = nobody read only = true use chroot = no transfer logging = true log format = %h %o %f %l %b log file = /var/log/rsyncd.log [FTP] path = /srv/ftp comment = An Example
Start the rsyncd daemon as user
To automatically start the rsync service upon system boot, call:
List all files located in the
/srv/ftp directory (note the double colon):
rsync -avz sun::FTP
Initiate the transfer by providing a target directory (in this example the current directory is represented by a dot):
rsync -avz sun::FTP .
By default, files are not deleted while synchronizing with rsync. To
force file deletion, add the
--delete option. To make sure
--delete does not accidentally remove newer
files, use the
--update option instead. Any conflicts that
arise must be resolved manually.
|Use Setup for Home Networks Only|
The setup featured in the following sections is suited for use in home networks only. Do not deploy it to sites wholly unprotected by firewalls and do not enable world wide access.
To configure an FTP server, proceed as follows:
Prepare the FTP server:
Open a shell, login as
root and save a backup copy of
cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
Create an access point for anonymous FTP
mkdir ~ftp/incoming chown -R ftp:ftp ~ftp/incoming
Replace the configuration files depending on the scenario you prefer (refer to the manual page of vsftpd.conf for advanced configuration options):
# listen=YES # Enable anonymous access to FTP server anonymous_enable=YES # local_enable=YES # Enable write access write_enable=YES anon_upload_enable=YES anon_mkdir_write_enable=YES dirmessage_enable=YES # Write log file xferlog_enable=YES connect_from_port_20=YES chown_uploads=YES chown_username=ftp ftpd_banner=Welcome to FTP service. anon_root=/srv/ftp
Restart the FTP server:
On the client, just enter the URL
ftp:// in your browser or
FTP client. Replace
HOST with either the
hostname or the IP address of your server. There are many graphical user
interfaces available that are suited to browse the contents of your FTP
server. For a list of them, just enter FTP at the search prompt of the
YaST package manager.