どのようにパスにパスワードをscp?
-
09-06-2019 - |
質問
いで推奨されていないものができるもので、ユーザーのパスワードscp?
思コピー、ファイルをscpタイマーラッチの一部としてバッチジョブの受信サーバーはもちろん、パスワードの入力が必要になり、いいえ、できないので簡単に変更するキー認証を行います。
他のヒント
使用 sshpass:
sshpass -p "password" scp -r user@example.com:/some/remote/path /some/local/path
はすでにパスワードなのbashの歴史
sshpass -f "/path/to/passwordfile" scp -r user@example.com:/some/remote/path /some/local/path
上記のコピーの内容をパスからのリモートホストをします。
ルインストール
- ubuntu/debian
apt install sshpass
- centos/fedora
yum install sshpass
- mac w/macports
port install sshpass
- mac w/brew
brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
で生成しsshキーのように:
ssh-keygen -t rsa -C "your_email@youremail.com"
コピーするコンテンツの ~/.ssh/id_rsa.pub
最後に追加し、リモート機械 ~/.ssh/authorized_keys
必ずリモートマシンのアクセス権 0700 for ~./ssh folder
や 0600 for ~/.ssh/authorized_keys
接続する場合のサーバーをWindowsにインストールパテー版(scp"pscp")オペレーションダイアログを通過するパスワードの -pw
パラメータとします。
利用できるのを期待スクリプトをunixでは/端末
例えば作成。exp':
#!/usr/bin/expect
spawn scp /usr/bin/file.txt root@<ServerLocation>:/home
set pass "Your_Password"
expect {
password: {send "$pass\r"; exp_continue}
}
スクリプトを実行し
expect test.exp
い役立っています。
カールとして使用できる代替scpコピーをファイルをサポートしているパスワードのコマンドライン.
curl --insecure --user username:password -T /path/to/sourcefile sftp://desthost/path/
ここで、制御することが可能である。んで expect
ツール:
sub copyover {
$scp=Expect->spawn("/usr/bin/scp ${srcpath}/$file $who:${destpath}
+/$file");
$scp->expect(30,"ssword: ") || die "Never got password prompt from
+ $dest:$!\n";
print $scp 'password' . "\n";
$scp->expect(30,"-re",'$\s') || die "Never got prompt from parent
+system:$!\n";
$scp->soft_close();
return;
}
誰もいないですが、 パテscp (pscp)-pwオプションのためのパスワードになります。
文書で、できるだけ早く送ってくださ https://the.earth.li/~sgtatham/パテ/0.67/libcanberra/第5章html#pscp
いただくには"期待"ツール前のない場合などについてお話をうかがっ
# apt-get install expect
の作成スクリプトファイルに以下の内容です。(#vi/root/scriptfile)
spawn scp /path_from/file_name user_name_here@to_host_name:/path_to
expect "password:"
send put_password_here\n;
interact
スクリプトを実行すファイル"期待"ツール
# expect /root/scriptfile
一度設定すれば ssh-keygen
として上記で説明できない
scp -i ~/.ssh/id_rsa /local/path/to/file remote@ip.com:/path/in/remote/server/
希少なタイピングの各時間の変更ができ .bash_profile
ファイル入れ
alias remote_scp='scp -i ~/.ssh/id_rsa /local/path/to/file remote@ip.com:/path/in/remote/server/
それからターミナルからない source ~/.bash_profile
.その後の場合タイプ remote_scp
ご使用の端末での scp
コマンドなしパスワードになります。
使 ssh-copy-id
追加sshキー:
$which ssh-copy-id #check whether it exists
場合である。
ssh-copy-id "user@remote-system"
代替する追加の公半のユーザーの権限-キーファイルのターゲットシステム.システムにおいて開始からの送迎ができ、ssh-agentデーモンメモリの使用範囲のサイズは個人の半分の鍵を握る。バッチジョブを設定するためのエージェントを利用の場合はこの鍵によ促すためのキーのパスワードになります。
こういうときはUNIX/LinuxシステムまたはWindowsプラットフォーム用のページェントとpscp.
テsshpassのためのrhel/centos6:
# wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
# yum install sshpass
そのものの答え こちらの.
rsync -r -v --progress -e ssh user@remote-system:/address/to/remote/file /home/user/
だとすることができますが、パスワードもこの進捗バーがcopyingをご覧ください。本当に素晴らしい。