Update 20221103.6 ️ How To Securely Transfer Files With SCP In Linux.md

This commit is contained in:
六开箱 2022-11-04 01:28:46 +08:00 committed by GitHub
parent b7e72a6ea7
commit bf8ae28fb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,16 +104,16 @@ scp -r User@RemoteHost1:RemoteDirectory User@RemoteHost2:DestinationPath
The most commonly used options of SCP command are:
- **`-C`** : Enable compression. Here, C stands for Compression. When you use this option, the data transfer speed will be faster, because the data is compressed. SCP will automatically enable the compression at the source system and decompression at the destination system.
- **-c <cipher>** : c stands for cipher. By default, SCP uses **'AES-128'** encryption method for encrypting data. You can change the encryption method using `-c` option.
- **`-c <cipher>`** : c stands for cipher. By default, SCP uses **'AES-128'** encryption method for encrypting data. You can change the encryption method using `-c` option.
- **`-i <identity_file>`** : i stands for Identity file or Private key. As you already know, there are password-based and key-based authentication used in SSH. If you want to use key-based authentication while transferring files, you can use the -i option to specify the Identity file or Private key.
- **`-l limit`** : l stands for limit bandwidth. Using this option, you can set the maximum bandwidth used for transferring data. The limit should be specified in **`Kbit/s`**.
- **-F <ssh_config>** : Some times, you may need to use different networks to connect to your Linux systems. Or you may be behind a proxy server. In such situations, you can use different `ssh_config` file using `-F` option.
- **`-F <ssh_config>`** : Some times, you may need to use different networks to connect to your Linux systems. Or you may be behind a proxy server. In such situations, you can use different `ssh_config` file using `-F` option.
- **`-P port`** - P stands for Port. Please note that it is uppercase P. By default, SSH uses port number 22. You might have changed the port number in the destination host for security reasons. In that case, you should explicitly mention the new port number using `-P` option.
- **-p** : if you want to preserve modification times, access times, and modes from the original file, you need to use -p option while copying files. Please note that it is lowercase p.
- **`-p`** : if you want to preserve modification times, access times, and modes from the original file, you need to use -p option while copying files. Please note that it is lowercase p.
- **`-r`** : Recursively copy entire directories.
- **`-B`** : B stands for batch mode. It is used for selecting batch mode while transferring files. It prevents asking for passwords or passphrases.
- **`-S program`** : Name of the program to use for the encrypted connection.
- **-v** : v stands for verbose. When using the `-v` option, the command will print the progress in your Terminal screen. So, you will see the what exactly is going on when the files are being transferred. It is useful in debugging connection, authentication, and configuration problems.
- **`-v`** : v stands for verbose. When using the `-v` option, the command will print the progress in your Terminal screen. So, you will see the what exactly is going on when the files are being transferred. It is useful in debugging connection, authentication, and configuration problems.
SCP has so many options. You can check the man pages of SCP command to learn about other options. Let us see some **useful scp command examples**.