Useful Tips

Everything that can be useful to the webmaster, server administrator, hosting, programmer and newbie on the Internet

Pin
Send
Share
Send
Send


The following requirements must be met both on the server and on the client side:

If you use hostnames, make sure that each name appears in / etc / hosts on the server and client. If you use IP addresses, you do not need to change anything.

If you are using a firewall, open the SSH port. Launch YaST and select Users and Security + Firewall. Next, Allowed Services and check if SSH is displayed in the list of allowed services. If not, select SSH from the Allow Service drop-down menu and click Add. Apply your changes and leave YaST by clicking Next and then Apply.

To copy files from the server to the client, you must know where the files are located on the server. For example, to copy a single / srv / foo_file from the jupiter.example.com server to the current directory, use the command scp (dot indicates the current directory):

To copy an entire directory, use recursive mode scp :

If your network does not have a name resolution service, use the server IP address directly:

If you do not know exactly where your file is located, use the command sftp . Copying files to KDE or GNOME using SFTP is very simple. Proceed as follows:

Press Alt + F2.

Enter the following in the address bar:

Enter your tux password at jupiter.example.com.

Drag your files or directories from the server to your desktop or local directory.

KDE provides another protocol called fish, which can be used if sftp is not available. Using this protocol is similar to sftp. Replace the sftp protocol prefix in the URL with fish:

11.4.2. Transferring files using rsync

Before using rsync to synchronize files and directories between different computers, make sure that the following requirements are met:

The rsync package is installed.

Identical users are present on both systems.

Sufficient disk space is available on the server.

If you want to take full advantage of rsync, make sure that the rsyncd daemon is installed on one of the systems.

rsync is useful for archiving or copying data and can also be used as a daemon to provide directories to the network (see Advanced Synchronization Setup with rsync).

11.4.2.1. Rsync basic mode

The basic rsync mode does not require any special configurations. rsync allows you to perfectly map entire directories from one system to another. Its use is not very different from a regular copy tool such as scp. The following command backs up the tux home directory on a backup server called jupiter:

Use the following command to restore data from your backup:

11.4.2.2. rsync in daemon mode (services)

Run the rsyncd daemon on one of your systems to use rsync fully. In this mode, it is possible to create synchronization points (modules), which can be accessed without accounts. To use the rsyncd daemon, do the following:

Procedure 11.1. Advanced sync setup using rsync

Log in as root and install the rsync package.

Configure your sync points in /etc/rsyncd.conf. Add the dot name in square brackets and the path keyword, as shown in the example:

Run the rsyncd daemon as root rcrsyncd start . To start the rsync daemon automatically at boot time, call insserv rsyncd .

To get a list of all the files located in the / srv / ftp directory, type (note: double colon):

Initiate the transfer by specifying the destination directory (in this example, the current directory is represented by a dot):

By default, files are not deleted during synchronization. To force file deletion, add the --delete option. To ensure that the --delete option does not accidentally delete new files, use the --update option instead. Any conflicts that arise must be resolved manually.

11.4.3. File Transfer Using Unison

Before using Unison to synchronize files and folders between different computers, make sure that the following requirements are met:

The unison package is installed.

You have enough free space on your local and remote computers.

If you want to take full advantage of Unison, make sure that Unison is installed and running on the remote computer.

If necessary, run Unison with the -doc topics option for a complete list of available topics.

For permanent settings, Unison allows you to create profiles that define Unison parameters, such as directories (roots) for synchronization, ignored file types, and other settings. Profiles are stored as text files in

/.unison with the extension * .prf.

11.4.3.1. Using GUI

To synchronize different directories using the Unison's GUI, do the following:

Launch Unison by pressing Alt + F2 and type unison .

If you started Unison for the first time and without any options, you will be asked for the source directory. Enter the source directory that you want to synchronize and click OK.

Enter the destination directory. It can be local or remote. If you want to synchronize with the remote directory, select the method (SSH, RSH or Socket) and enter both the host name and the secondary user.

If you have not synchronized these two directories before, a warning dialog box appears informing you that Unison will compare the contents of these directories. Close the warning by clicking OK and wait for Unison to collect the directory information and display the differences in the main window.

The left column shows the selected source directory, the third column shows the destination directory. If there are differences between the directories, the Actions column indicates the symbol of the proposed actions. A green arrow indicates that the file has been modified, added, or deleted in the source folder or destination folder. The direction of the arrow indicates the direction of the changes that will occur if synchronization is performed. A question mark indicates a conflict (that is, files have been modified and Unison will not automatically overwrite them).

Figure 11.1. File Sync Options

To change the Unison sentences shown for each file (for example, if you want to change the directory), select the file and click from right to left or left to right. Skip, excludes files from synchronization. The symbol in the Actions column changes accordingly.

To start synchronization, click Start.

The next time you start Unison, a dialog box for selecting profiles will be displayed, indicating a pair of directories for synchronization. Select a profile or create a new one (a couple more directories) and synchronize as described above.

11.4.3.2. Command line usage

Unison can also be invoked through the command line. To synchronize a local directory with a remote computer, do the following:

Open a console and enter the following command:

Replace labels with appropriate values.

Unison will ask you what to do with your files and directories, for example:

Press F if you want to follow the recommendations of Unison. To see other commands click? .

Press y if you want to update.

11.4.4. Copying Files Using FTP

Before setting up your FTP server, make sure that the following requirements are met:

The vsftp package is installed.

You have root access to the FTP server.

There is enough disk space on your computer.

These settings are for home use only. Do not apply them to sites that are not protected by a firewall and do not allow access from the Internet.

To configure the FTP server, do the following:

FTP server preparation:

Open the console, log in as root and make a backup of /etc/vsftpd.conf:

Create Access Point for Anonymous FTP

Replace the configuration files according to your needs (see the man page vsftpd.conf about advanced configuration options):

Restart FTP server

On the client machine, enter ftp: // HOST in your browser or FTP client. Replace HOST hostname or IP address of your server. There are many graphical user interfaces available that are suitable for navigating your FTP server. To view their list, enter FTP in the search bar of the YaST package manager.

Read more about.
For home networks only
July 2019
MonTueWedThFriSatSun
1234567
891011121314
15161718192021
22232425262728
293031

Copy files remotely using SCP

SCP (Secure Copy Protocol) - Linux command for secure copying files or folders to or from a remote computer (server) using the SSH (Secure Shell) protocol for this. SCP is part of the OpenSSH package. Thanks to ssh, SCP is a great replacement for the insecure FTP protocol, which is widely used on the Internet.

Sometimes there is the task of transferring files from one server to another.

I will give examples of how to use it.

We go to the server using the SSH protocol, for example, through the program - PuTTY (http://www.chiark.greenend.org.uk/

1. How to copy a file to a remote server:

We go to the directory from where you want to copy the file / files, for example file1.zip in the / home / directory, you need to copy it to the / home2 / folder on the remote computer. We are on the first server 192.168.0.1

[email protected] [/ home /] # scp file1.zip [email protected]: / home2 /
or from anywhere
[email protected] [/] # scp /home/file1.zip [email protected]: / home2 /
after entering you will be asked for a password to the remote server.
[email protected]'s password:

those. scp file user @ server_address (IP or domain): directory on the remote server where you want to copy it
if you need to copy several files, you can specify them with a space, i.e.: file1.zip file2.zip.

2. How to copy files and folders to a remote server:

for example, you need to copy several directories and there are many files in each directory. We are on the first server 192.168.0.1

[email protected] [/] # scp -r / home / [email protected]: / home2 /
after entering you will be asked for a password to the remote server.
[email protected]'s password:

everything will be copied that is in the directory / home /
those. scp directory_from_copy_folders_and_files user @ server_address (IP or domain): directory on the remote server where you want to copy it

option: -r - recursive copying of folders (including subdirectories),

3. How to copy a file from a remote server:

For example, on the remote server is file1.zip in the directory / home2 /, copy it to the local server (wherever you are) in the folder / home /. We are on the first server 192.168.0.1

[email protected] [/] # scp [email protected]: /home2/file1.zip / home /
after entering you will be asked for a password to the remote server.
[email protected]'s password:

those. we will copy the file1.zip file from the / home2 / folder to the / home / directory from the remote server

4. How to copy files and folders from a remote server:

[email protected] [/] # scp -r [email protected]: / home2 / / home /
after entering you will be asked for a password to the remote server.
[email protected]'s password:

those. copy everything that is in the / home2 / directory to your / home / directory from a remote server

option: -r - recursive copying of folders (including subdirectories),

5. How to copy files from one server to another being on the third.

[email protected] [/] # scp [email protected]: /home/file1.zip [email protected]: / home2 /
after entering you will be asked for a password to the remote servers.
[email protected]'s password:
[email protected]'s password:

those. we will copy the /home/file1.zip file from one remote server (192.168.0.1) to another remote server (192.168.0.2) in the / home2 / folder
being on the third server (192.168.0.3). You can copy files as well as folders using the -r option

Of course, few will need it :) but this is possible.

Possible SCP options:

-r - recursively copy folders (including subdirectories),

-P port - use a non-standard port (default is 22) - this parameter should be used if the server is waiting for a connection on a non-standard port. This option may be useful when connecting from a network protected by a firewall. Running an SSH server on port 443 (used for secure HTTP connections) is the best way to get around the restrictions set by your network administrator.

I hope I clearly painted how to use SCP.

Nitroshare

Nitroshare allows you to transfer files between two computers on the same local network. To work with the program, just install it on all systems. Nitroshare will instantly find all supported computers on the local network and set up file and folder sharing with them. The program is written in C ++ using the Qt library, which allows it to be used even on Windows and MacOS.

  • Auto discovery of supported systems,
  • Very fast file transfer and reception,
  • The file size is unlimited,
  • Supports folder transfer,
  • Dynamic file compression during transfer,
  • Checksum verification
  • Cross-platform,
  • There is an intuitive setup wizard.

Using Nirtoshare

After installation, run the program from the Dash menu or using the terminal:

When you first start, you will see a welcome window, just click Close:

Then find the program icon in the system tray and select the item in the context menu Send files or Send directory:

In the next window, select the folder you want to send:

Then the program will scan the network and show the available devices. It remains to select the device and click OK:

After the transfer is completed, a window appears informing you of the successfully completed operation:

Now let's move on to the target device. The file was actually received and saved on the desktop. By default, all files are saved to the desktop, but this can be configured in the Nitroshare options:

Similarly, file transfer over the network to ubuntu of any size between your devices can be performed. All you need to do is run the application on all systems.

Retroshare

Retroshare implements peer to peer technology. Unlike Nitroshare and other similar programs, you can only connect to trusted sites here. This is a completely decentralized, communication platform that allows you to transfer data both over the local network and over the Internet.

  • Private chat
  • File sharing over linux network,
  • Sending messages
  • Forums
  • VoIP communication,

The problem with modern file sharing networks is that you have no control over who is sharing files with you. RetroShare establishes an encrypted connection with key authentication. This connection is used for communication and file sharing. The program is independent of the central server and all data is transferred only between friends and in some cases friends of friends, which makes RetroShare a decentralized social network.

Manual way

This method is perfect if you need to transfer one or more files and you do not want to install any new programs on the system. The nc or netcat utility allows you to create tcp and unix sockets on the system. In fact, these are tunnels through which we can transfer any data, including files.

The utility is already preinstalled, so you don’t have to install anything else, you just need to know the ip addresses of computers on the network. First, create a listening socket on the computer, immediately write all the data received on it to a file:

nc -l -p 12345> newfile

Here is the option -p sets the port, you can take a private value only to match in both commands. Now send the file from another computer:

cat file | nc 192.168.1.2 12345

Here we indicate the same port and ip of the computer where the listening socket was launched - 192.168.1.2. We can transfer not only files, but also folders. Transfer can be performed in both directions, now we will send it not to the socket, and from the socket:

tar -cf - / data | nc -l -p 12345

And we receive the poisoned data on another computer:

nc 192.168.1.2 12345 | tar -xf -

You may ask, what application should I use? The answer depends on your needs, if you only need file exchange - nitroshare, if you want more features such as secure chat, VoIP and forum, then RetroShare is the best choice. And if you do not want to install anything and transferring files over a linux network, transferring files over a network should be only once, try nc.

Pin
Send
Share
Send
Send