Is It Safe to Read the Scp 001 Page
Linux administrators should exist familiar with the CLI environment. Since GUI mode in Linux servers is not mutual to be installed. SSH may be the near pop protocol to enable Linux administrators to manage the servers via remote secure mode. Built-in with SSH command there is SCP command. SCP is used to copy file(s) betwixt servers in a secure way.
[ You might also similar: How to Secure and Harden OpenSSH Server ]
Bones Syntax of SCP Command
The below command will read equally "re-create source_file_name" into "destination_folder" at "destination_host" using "username account".
scp source_file_name [email protected]_host:destination_folder
There are many parameters in the SCP control that y'all can utilize. Here are the parameters that may use on daily basis usage.
Provide the detailed information of the SCP process using the -v parameter
The basic SCP command without parameters will re-create the files in the background. Users will see zip unless the process is done or some mistake appears.
You lot can use the "-v" parameter to impress debug information into the screen. It can aid you debugging connection, authentication, and configuration problems.
[email protected] ~/Documents $ scp -v Label.pdf [email protected]@202.x.x.x:.
Sample Output
SCP Testify Progress While Copying Files
Executing: program /usr/bin/ssh host 202.x.x.x, user mrarianto, command scp -v -t . OpenSSH_6.0p1 Debian-iii, OpenSSL i.0.1c ten May 2012 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to 202.x.x.10 [202.x.10.ten] port 22. debug1: Connection established. debug1: Host '202.x.ten.x' is known and matches the RSA host fundamental. debug1: Found central in /home/pungki/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: Next authentication method: password [email protected]'s password: debug1: Authentication succeeded (password). Authenticated to 202.x.x.10 ([202.ten.10.x]:22). Sending file modes: C0770 3760348 Characterization.pdf Sink: C0770 3760348 Label.pdf Label.pdf 100% 3672KB 136.0KB/s 00:27 Transferred: sent 3766304, received 3000 bytes, in 65.2 seconds Bytes per 2d: sent 57766.4, received 46.0 debug1: Exit status 0
Provide modification times, access times, and modes from original files
The "-p" parameter volition help you with this. An estimated time and the connectedness speed will appear on the screen.
[electronic mail protected] ~/Documents $ scp -p Label.pdf [email protected]:.
Sample Output
SCP Estimating the Time Needed to Copy Large File
[email protected]'s password: Label.pdf 100% 3672KB 126.6KB/s 00:29
Make file transfer faster using -C parameter
One of the parameters that tin can faster your file transfer is the "-C" parameter. The "-C" parameter will shrink your files on the get. The unique affair is the compression-only happens in the network. When the file has arrived at the destination server, it volition be returning to the original size every bit earlier the compression happen.
Take a look at these commands. It is using a unmarried file of 93 Mb.
[e-mail protected] ~/Documents $ scp -pv letters.log [e-mail protected]:.
Sample Output
SCP Transfers File Without Compression
Executing: program /usr/bin/ssh host 202.x.10.10, user mrarianto, control scp -v -p -t . OpenSSH_6.0p1 Debian-3, OpenSSL one.0.1c 10 May 2012 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line xix: Applying options for * debug1: Connecting to 202.x.ten.x [202.x.x.x] port 22. debug1: Connection established. debug1: identity file /home/pungki/.ssh/id_rsa type -one debug1: Institute key in /abode/pungki/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: Trying private cardinal: /home/pungki/.ssh/id_rsa debug1: Adjacent hallmark method: countersign [e-mail protected]'due south password: debug1: Authentication succeeded (password). Authenticated to 202.10.x.x ([202.x.x.ten]:22). debug1: Sending command: scp -v -p -t . File mtime 1323853868 atime 1380425711 Sending file timestamps: T1323853868 0 1380425711 0 messages.log 100% 93MB 58.6KB/s 27:05 Transferred: sent 97614832, received 25976 bytes, in 1661.3 seconds Bytes per 2nd: sent 58758.four, received xv.6 debug1: Exit status 0
Copying files without the "-C" parameter will outcome in 1661.three seconds. Y'all may compare the outcome to the control beneath which using the "-C" parameter.
[e-mail protected] ~/Documents $ scp -Cpv messages.log [email protected]:.
Sample Output
SCP Transfers File Faster Using Compression
Executing: program /usr/bin/ssh host 202.ten.x.x, user mrarianto, control scp -v -p -t . OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c ten May 2012 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to 202.x.ten.x [202.x.x.x] port 22. debug1: Connection established. debug1: identity file /domicile/pungki/.ssh/id_rsa type -1 debug1: Host '202.10.ten.x' is known and matches the RSA host key. debug1: Found cardinal in /home/pungki/.ssh/known_hosts:one debug1: ssh_rsa_verify: signature correct debug1: Next authentication method: publickey debug1: Trying private key: /home/pungki/.ssh/id_rsa debug1: Next authentication method: password [e-mail protected]'s countersign: debug1: Enabling compression at level 6. debug1: Hallmark succeeded (countersign). Authenticated to 202.10.ten.x ([202.x.x.x]:22). debug1: channel 0: new [client-session] debug1: Sending control: scp -v -p -t . File mtime 1323853868 atime 1380428748 Sending file timestamps: T1323853868 0 1380428748 0 Sink: T1323853868 0 1380428748 0 Sending file modes: C0600 97517300 messages.log letters.log 100% 93MB 602.7KB/south 02:38 Transferred: sent 8905840, received 15768 bytes, in 162.v seconds Bytes per 2nd: sent 54813.ix, received 97.0 debug1: Go out status 0 debug1: shrink approachable: raw data 97571111, compressed 8806191, factor 0.09 debug1: compress incoming: raw data 7885, compressed 3821, gene 0.48
Every bit y'all can meet, when you are using compression, the transfer process is washed in 162.5 seconds. It is ten times faster than non using the "-C" parameter. If you are copying a lot of files beyond the network, the "-C" parameter would help you lot to decrease the full time you lot need.
The thing that nosotros should observe is that the compression method will not work on any files. When the source file is already compressed, you volition non find any comeback there. Files such equally .zip, .rar, pictures, and .iso files will not exist affected by the "-C" parameter.
Alter SCP Zippo to Encrypt Files
By default SCP using "AES-128" to encrypt files. If you want to change to another nix to encrypt it, y'all tin can use the "-c" parameter. Accept a wait at this command.
[email protected] ~/Documents $ scp -c 3des Label.pdf [e-mail protected]:. [electronic mail protected]'due south countersign: Characterization.pdf 100% 3672KB 282.5KB/s 00:13
The above command tells SCP to utilise the 3des algorithm to encrypt the file. Please be careful that this parameter using "-c" not "-C".
Limiting Bandwidth Usage with SCP Command
Another parameter that may be useful is the "-l" parameter. The "-50" parameter volition limit the bandwidth to employ. It will be useful if you do an automation script to copy a lot of files, but you lot don't want the bandwidth is drained past the SCP process.
[email protected] ~/Documents $ scp -l 400 Label.pdf [email protected]:. [e-mail protected]'s countersign: Label.pdf 100% 3672KB 50.3KB/s 01:13
The 400 value behind the "-l" parameter is mean that nosotros limit the bandwidth for the SCP procedure to just fifty KB/sec. 1 thing to remember is that bandwidth is specified in Kilobits/sec (kbps). It is mean that viii bits are equal to 1 byte.
While SCP counts in Kilobyte/sec (KB/due south). And then if you want to limit your bandwidth for SCP maximum of only 50 KB/due south, you need to set up it into 50 10 8 = 400.
Specify the Specific port to use with SCP
Usually, SCP is using port 22 as a default port. Merely for security reasons, you may change the port into another port. For case, we are using port 2249. Then the command should exist similar this.
[electronic mail protected] ~/Documents $ scp -P 2249 Characterization.pdf [electronic mail protected]:. [email protected]'s password: Label.pdf 100% 3672KB 262.3KB/s 00:xiv
Make certain that it uses capital letter "P" not "p" since "p" is already used for preserved times and modes.
Copy files inside directory recursively
Sometimes we need to re-create the directory and all files/directories inside it. It will be better if we can exercise it in 1 command. SCP supports that scenario using the "-r" parameter.
[email protected] ~/Documents $ scp -r documents [email protected]:. [e-mail protected]'due south countersign: Label.pdf 100% 3672KB 282.5KB/due south 00:13 scp.txt 100% 10KB nine.8KB/southward 00:00
When the copy process is washed, at the destination server you will plant a directory named "documents" with all its files. The binder "documents" is automatically created.
Disable progress meter and warning / diagnostic message
If you lot choose not to see progress meter and warning / diagnostic letters from SCP, you may disable it using the "-q" parameter. Hither's the case.
[email protected] ~/Documents $ scp -q Characterization.pdf [email protected]:. [email protected]'s password: [email protected] ~/Documents $
Every bit you can see, after yous enter the password, there is no data about the SCP procedure. Afterward the process is complete, you volition run across a prompt again.
Re-create files using SCP through Proxy
The proxy server is unremarkably used in the role environment. Natively, SCP is non proxy configured. When your environment using a proxy, y'all take to "tell" SCP to communicate with the proxy.
Here'due south the scenario. The proxy address is ten.0.96.6 and the proxy port is 8080. The proxy also implemented user authentication. Get-go, you need to create the "~/.ssh/config" file. 2d, you put this command inside it.
ProxyCommand /usr/bin/corkscrew x.0.96.6 8080 %h %p ~/.ssh/proxyauth
And then you need to create file "~/.ssh/proxyauth" which contains.
myusername:mypassword
After that, you can exercise SCP transparently as usual.
Please notice that the corkscrew is might not be installed yet on your system. On my Linux Mint, I need to install it kickoff, using the standard Linux Mint installation procedure.
$ apt-get install corkscrew
For other yum-based systems, users can install corkscrew using the following yum command.
# yum install corkscrew
Another matter is that since the "~/.ssh/proxyauth" file contains your "username" and "countersign" in clear-text format, please brand sure that the file can be accessed by yous only.
Select different ssh_config file
For mobile users who often switch between the company networks and public networks, information technology will be suffering to always alter settings in SCP. Information technology is better if we can put a different ssh_config file to match our needs.
Here's a sample scenario
Proxy is used in the company network but not in the public network and you regularly switch networks.
[email protected] ~/Documents $ scp -F /dwelling/pungki/proxy_ssh_config Characterization.pdf [email protected]:. [email protected]'s password: Label.pdf 100% 3672KB 282.5KB/southward 00:13
By default "ssh_config" file per user volition be placed in "~/.ssh/config". Creating a specific "ssh_config" file with proxy compatibility will make it easier to switch between networks.
When y'all are on the company network, you can use the "-F" parameter. When y'all are on a public network, yous can skip the "-F" parameter.
[ You might as well similar: Pscp – Transfer/Copy Files to Multiple Linux Servers Using Single Shell ]
That'due south all nigh SCP. You can see human pages of SCP for more detail. Delight feel gratuitous to leave comments and suggestions.
Source: https://www.tecmint.com/scp-commands-examples/
0 Response to "Is It Safe to Read the Scp 001 Page"
Post a Comment