日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux命令之远程文件或文件夹拷贝-scp

發(fā)布時間:2025/3/21 linux 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux命令之远程文件或文件夹拷贝-scp 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

在linux安裝部署或者升級分布式系統(tǒng)時,經(jīng)常要重當(dāng)前主機(jī)拷貝文件到集群中其他的主機(jī)節(jié)點(diǎn),或者從其他主機(jī)節(jié)點(diǎn)拷貝文件到當(dāng)前主機(jī)。

我們知道cp命令是同一主機(jī)下面文件的拷貝,而scp命令就是linux下實(shí)現(xiàn)遠(yuǎn)程主機(jī)之間文件拷貝的命令,支持向遠(yuǎn)程主機(jī)‘推文件’和向遠(yuǎn)程主機(jī)‘拉文件’的方式。

輸入scp -h看看選項(xiàng):

$ scp -h unknown option -- h usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file][-l limit] [-o ssh_option] [-P port] [-S program][[user@]host1:]file1 ... [[user@]host2:]file2
列出了一些選項(xiàng)和大致的用法,不過具體選項(xiàng)是什么意思并不知道。

輸入man scp看看說明:

SCP(1) BSD General Commands Manual SCP(1)NAMEscp — secure copy (remote file copy program)SYNOPSISscp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 ... [[user@]host2:]file2DESCRIPTIONscp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1). scp will ask for passwords orpassphrases if they are needed for authentication.File names may contain a user and host specification to indicate that the file is to be copied to/from that host. Local file names can be made explicit using absolute or relative pathnamesto avoid scp treating file names containing ‘:’ as host specifiers. Copies between two remote hosts are also permitted.The options are as follows:-1 Forces scp to use protocol 1.-2 Forces scp to use protocol 2.-3 Copies between two remote hosts are transferred through the local host. Without this option the data is copied directly between the two remote hosts. Note that this option dis‐ables the progress meter.-4 Forces scp to use IPv4 addresses only.-6 Forces scp to use IPv6 addresses only.-B Selects batch mode (prevents asking for passwords or passphrases).-C Compression enable. Passes the -C flag to ssh(1) to enable compression.-c cipherSelects the cipher to use for encrypting the data transfer. This option is directly passed to ssh(1).-F ssh_configSpecifies an alternative per-user configuration file for ssh. This option is directly passed to ssh(1).-i identity_fileSelects the file from which the identity (private key) for public key authentication is read. This option is directly passed to ssh(1).-l limitLimits the used bandwidth, specified in Kbit/s.-o ssh_optionCan be used to pass options to ssh in the format used in ssh_config(5). This is useful for specifying options for which there is no separate scp command-line flag. For fulldetails of the options listed below, and their possible values, see ssh_config(5).AddressFamilyBatchModeBindAddressCanonicalDomainsCanonicalizeFallbackLocalCanonicalizeHostnameCanonicalizeMaxDotsCanonicalizePermittedCNAMEsCertificateFileChallengeResponseAuthenticationCheckHostIPCipherCiphersCompressionCompressionLevelConnectionAttemptsConnectTimeoutControlMasterControlPathControlPersistGlobalKnownHostsFileGSSAPIAuthenticationGSSAPIDelegateCredentialsHashKnownHostsHostHostbasedAuthenticationHostbasedKeyTypesHostKeyAlgorithmsHostKeyAliasHostNameIdentityFileIdentitiesOnlyIPQoSKbdInteractiveAuthenticationKbdInteractiveDevicesKexAlgorithmsLogLevelMACsNoHostAuthenticationForLocalhostNumberOfPasswordPromptsPasswordAuthenticationPKCS11ProviderPortPreferredAuthenticationsProtocolProxyCommandPubkeyAcceptedKeyTypesPubkeyAuthenticationRekeyLimitRhostsRSAAuthenticationRSAAuthenticationSendEnvServerAliveIntervalServerAliveCountMaxStrictHostKeyCheckingTCPKeepAliveUpdateHostKeysUsePrivilegedPortUserUserKnownHostsFileVerifyHostKeyDNS-P portSpecifies the port to connect to on the remote host. Note that this option is written with a capital ‘P’, because -p is already reserved for preserving the times and modes of thefile.-p Preserves modification times, access times, and modes from the original file.-q Quiet mode: disables the progress meter as well as warning and diagnostic messages from ssh(1).-r Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal.-S programName of program to use for the encrypted connection. The program must understand ssh(1) options.-v Verbose mode. Causes scp and ssh(1) to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems.EXIT STATUSThe scp utility exits 0 on success, and >0 if an error occurs.SEE ALSOsftp(1), ssh(1), ssh-add(1), ssh-agent(1), ssh-keygen(1), ssh_config(5), sshd(8)HISTORYscp is based on the rcp program in BSD source code from the Regents of the University of California.AUTHORSTimo Rinne <tri@iki.fi>Tatu Ylonen <ylo@cs.hut.fi>BSD September 25, 2015 BSD

里面常用的選項(xiàng)有,-r 拷貝目錄,-v 顯示拷貝時的調(diào)試信息,對于拷貝文件出錯有幫助,-l 限制拷貝時帶寬等。

總結(jié)

以上是生活随笔為你收集整理的linux命令之远程文件或文件夹拷贝-scp的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。