天道酬勤,学无止境

scp

Smart way to copy multiple files from different paths usinc scp

I would like to know an easy way to use scp to copy files and folders that are present in different paths on my file system. The ssh destination server requests a password and I cannot put this in configuration files. I know that scp doesn't have a password parameter that I could supply from a script, so for now I must copy each file or directory one by one, writing my password every time.

2021-11-28 18:16:18    分类:问答    ssh   scp

File location if target path not specified with scp command

To copy a folder from local computer to server I use scp -r local_folder user@server:path Now I forgot to specify the target path the first time: scp -r local_folder user@server Does anyone now if the folder has been copied and if yes, where in the server is it located at? I issued the correct command later and copied the folder to my user directory but I just want to know whether the folder is also copied somewhere on the server the first time and find and delete it. I am a user and don't have permission to search the whole server. Thanks.

2021-11-28 11:41:07    分类:问答    scp

nohup 导致“read_passphrase:无法打开/dev/tty”(nohup causes "read_passphrase: can't open /dev/tty")

问题 我在脚本 nohupssh.sh 中有一个简单的远程 ssh 命令 sleep 30 ssh -v -l developer server11 "/usr/local/jdk1.7.0_45/bin/jmap -histo:live 1770;" 我运行脚本如下: nohup nohupssh.sh > out.log 2>&1 & 当我如上所示执行它时,jmap 实用程序在远程服务器上成功执行。 但是,如果我如上所示执行它并退出 bash shell,我会收到如下所示的错误。 请注意,我在本地和远程服务器上都有一个格式正确的 authorized_keys。 另请注意,任一服务器中都没有 id_rsa,因为这些服务器是共享的。 我尝试了很多组合: ssh -v -A -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null server11 .... 但无济于事。 我仔细检查了 ssh 的手册页以寻找线索,尝试了各种选项。 我认为必须有一个或一组 ssh 选项可以解决这个问题。 真正的脚本(而不是上面删节的)也有 scp 。 因此,我希望我所不知道的选项对 scp 和 ssh 都适用。 完整的详细日志是 OpenSSH_4.3p2

2021-11-28 05:24:55    分类:技术分享    ssh   scp   nohup

How to scp to Amazon s3?

I need to send backup files of ~2TB to S3. I guess the most hassle-free option would be Linux scp command (have difficulty with s3cmd and don't want an overkill java/RoR to do so). However I am not sure whether it is possible: How to use S3's private and public keys with scp, and don't know what would be my destination IP/url/path? I appreciate your hints.

2021-11-28 04:16:39    分类:问答    linux   amazon-s3   scp

How to download a file from EC2 instance to Local Computer

i have an instance of ec2.it have some files.i tried to download my file from ec2 instance to my local Ubuntu 13.10.i run this command scp -i /home/ritesh/.ssh/id_rsa2 apps@XXX.20.24.XXX:/home/apps/dev/comp-eng/arena-client/build/arena-client-7.1.0.zip and in output i am getting 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 i am using correct format i think.why i am facing this error instead of downloading file ??

2021-11-28 01:50:09    分类:问答    amazon-web-services   amazon-ec2   scp

Timeout in paramiko (python)

I'm looking for a way to set a timeout for this: transport = paramiko.Transport((host, port)) transport.connect(username = username, password = password) sftp = paramiko.SFTPClient.from_transport(transport) sftp.get(remotepath, localpath) sftp.close() transport.close()

2021-11-27 22:10:47    分类:问答    python   ssh   timeout   scp   paramiko

如何在没有服务器访问 repo 的情况下从 git repo 部署?(How to deploy from git repo without server having access to repo?)

问题 我在 BitBucket git repo 中有一个 PHP 项目。 我在一个名为“develop”的分支中工作以进行小修复,或者我在临时功能分支中工作。 当我准备好部署时,我将这些分支合并到“master”中。 我想让部署到我的实时站点就这么简单(合并到 master 并推送到 BitBucket)。 但我真的不希望我的服务器可以访问我的 repo,因为这增加了安全问题。 如果您关心安全性,您希望您的存储库尽可能少地位于。 如果您的服务器遭到入侵,情况已经够糟了,但如果攻击者可以访问我的完整存储库,情况会更糟。 这个人同意。 所以我假设我想使用git archive master类的东西,就像 https://stackoverflow.com/a/163769/470749 解释的那样。 我如何设置一个钩子来检测“master”的推送,然后运行git archive master将最新的代码(虽然不是作为 repo)导出到一个压缩的 zip 文件,然后它会发送(通过 SCP 和/或 Rsync ?) 到远程服务器,将其解压缩到一个新目录,然后(可能通过更改符号链接)将服务器指向该新目录? 额外问题:我怎样才能启用简单的紧急回滚? (我想可能在某些情况下我想快速恢复到之前的提交。) 回答1 我对我最终得到的脚本很满意: 部署.sh: ##This executable

2021-11-27 06:25:03    分类:技术分享    git   deployment   rsync   scp

How do I provide a zip file for download from an AWS EC2 instance running Ubuntu?

I have created a Flask app that is capable of uploading multiple files to the EC2 instance. My flass app code: import os from flask import Flask, request, render_template, url_for, redirect import flask #Initialize the app by adding: app = Flask(__name__) #Add the below line to create the home page route: @app.route("/") def fileFrontPage(): return render_template('index.html') @app.route("/handleUpload", methods=['POST']) def handleFileUpload(): files = flask.request.files.getlist("photo") protocol = 'pscp -i' key_loc = ' key_loc' upload_dir = ' dir' ec2_instance = ' instance_name' remote_dir

2021-11-27 02:02:40    分类:问答    python-3.x   amazon-ec2   scp

使用 Mercurial,是否有一种简单的方法可以将我的工作副本与默认远程存储库中的提示文件进行比较(Using Mercurial, is there an easy way to diff my working copy with the tip file in the default remote repository)

问题 使用 mercurial 时,我希望能够将文件的工作副本与默认远程存储库中的提示文件进行比较。 是否有捷径可寻? 我知道我可以做一个“hgincoming -p”来查看进入的更改补丁集,但是如果我做一个pull,那么直接查看特定文件的实际更改会很好最新的东西(或者我可能要推出的东西)。 我现在能想到的最简单的事情是创建一个小脚本来查看 .hg/hgrc 中的默认位置并使用 curl 下载文件(如果它通过 http,否则通过 ssh scp,或者只是做一个如果它在本地文件系统上,则直接 diff)然后将工作副本或提示与该临时副本进行比较。 我正在尝试向我的团队出售 mercurial,我的一名团队成员今天提出了这一点,因为他们可以使用他们的 GUI 工具在 SVN 中轻松完成。 回答1 经过一番挖掘,我发现了 Rdiff 扩展,它可以完成我想要的大部分功能。 它不随 mercurial 一起提供,但可以通过克隆存储库来安装它: hg clone http://hg.kublai.com/mercurial/extensions/rdiff 然后修改您的 ~/.hgrc 文件以加载扩展名: [extensions] rdiff=~/path/to/rdiff/repo/rdiff.py 这有点古怪,因为它实际上通过检测第一个参数是否是远程 URL 来修改现有的“hg diff

2021-11-26 13:49:55    分类:技术分享    svn   http   mercurial   diff   scp

Scp through ssh tunnel opened

I want to send files from machineA which has opened a reverse tunnel with a server. The reverse tunnel connects port 22 on machineA with port 2222 on the server: autossh -M 0 -q -f -N -o "ServerAliveInterval 120" -o "ServerAliveCountMax 1" -R 2222:localhost:22 userserver@server.com If I do: scp file userserver@server.com:. then SCP sends the file with a new login over SSH, in my case using public/private key. But if I do: scp -P 2222 file userserver@localhost:. I get a "connection refused" message. The same happens if I replace 2222 above with the port found with: netstat | grep ssh | grep

2021-11-24 08:51:35    分类:问答    ssh   scp   ssh-tunnel