SSHを用いた転送
来源:互联网 发布:c语言 strlen 编辑:程序博客网 时间:2024/05/21 09:12
rsyncを使用する場合、SSHを用いたセキュアな転送を推奨します。
以下の設定を行い、パスワード無しのSSH転送を行います。
(1) 鍵の生成
[root@localhost tmp]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):enterキー
Enter passphrase (empty for no passphrase):enterキー
Enter same passphrase again:enterキー
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
db:d5:4d:8c:b1:bf:3d:3f:3b:26:d3:bf:d2:82:b8:28 root@localhost
以上の操作で/root/.ssh に、秘密鍵「id_dsa」と公開鍵「id_dsa.pub」 というファイルが生成されます。
(2) 鍵の配置
公開鍵を公開先サーバにコピーします。
[root@localhost tmp]# scp -p /root/.ssh/id_dsa.pub 公開先サーバのIPアドレス:/root/.ssh/
公開先サーバのホスト上でコピーした公開鍵を~/.ssh/authorized_keys に追加します。
[root@www ~]# cd /root/.ssh
[root@www .ssh]# cat id_dsa.pub >> authorized_keys
[root@www .ssh]# rm id_dsa.pub
[root@www .ssh]# chmod 600 authorized_keys
(3) 転送コマンドの実行と確認
コマンドを実行し、転送の確認を行います。
[root@localhost ~]# /usr/local/bin/rsync -a --delete --bwlimit=2048 --timeout=120 -e ssh /usr/local/ZoomSight/dictionary/ <公開先サーバのユーザ>@<公開先サーバアドレス>:<公開先サーバのディレクトリパス>
The authenticity of host 'xxx.xxx.x.x (xxx.xxx.x.x)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:x:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'xxx.xxx.x.x' (RSA) to the list of known hosts.
[root@localhost ~]#
再度、同じコマンドを実行し、認証確認と警告メッセージが出力されないことを確認します。
[root@localhost ~]# /usr/local/bin/rsync -a --delete --bwlimit=2048 --timeout=120 -e ssh /usr/local/4ucms/website/ <公開先サーバのユーザ>@<公開先サーバアドレス>:<公開先サーバのディレクトリパス>
[root@localhost ~]#
以上で設定は終了です。これでプロキシサーバから音声変換サーバへパスワード無しのSSH転送が可能となります。
以下の設定を行い、パスワード無しのSSH転送を行います。
(1) 鍵の生成
[root@localhost tmp]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):enterキー
Enter passphrase (empty for no passphrase):enterキー
Enter same passphrase again:enterキー
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
db:d5:4d:8c:b1:bf:3d:3f:3b:26:d3:bf:d2:82:b8:28 root@localhost
以上の操作で/root/.ssh に、秘密鍵「id_dsa」と公開鍵「id_dsa.pub」 というファイルが生成されます。
(2) 鍵の配置
公開鍵を公開先サーバにコピーします。
[root@localhost tmp]# scp -p /root/.ssh/id_dsa.pub 公開先サーバのIPアドレス:/root/.ssh/
公開先サーバのホスト上でコピーした公開鍵を~/.ssh/authorized_keys に追加します。
[root@www ~]# cd /root/.ssh
[root@www .ssh]# cat id_dsa.pub >> authorized_keys
[root@www .ssh]# rm id_dsa.pub
[root@www .ssh]# chmod 600 authorized_keys
(3) 転送コマンドの実行と確認
コマンドを実行し、転送の確認を行います。
[root@localhost ~]# /usr/local/bin/rsync -a --delete --bwlimit=2048 --timeout=120 -e ssh /usr/local/ZoomSight/dictionary/ <公開先サーバのユーザ>@<公開先サーバアドレス>:<公開先サーバのディレクトリパス>
The authenticity of host 'xxx.xxx.x.x (xxx.xxx.x.x)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:x:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'xxx.xxx.x.x' (RSA) to the list of known hosts.
[root@localhost ~]#
再度、同じコマンドを実行し、認証確認と警告メッセージが出力されないことを確認します。
[root@localhost ~]# /usr/local/bin/rsync -a --delete --bwlimit=2048 --timeout=120 -e ssh /usr/local/4ucms/website/ <公開先サーバのユーザ>@<公開先サーバアドレス>:<公開先サーバのディレクトリパス>
[root@localhost ~]#
以上で設定は終了です。これでプロキシサーバから音声変換サーバへパスワード無しのSSH転送が可能となります。
0 0
- SSHを用いた転送
- 用SSH连接SSH连接nitrous.io
- SSH登陆,用XShell
- 为什么要用SSH?
- 用SSH代理上网
- 为什么要用SSH?
- 用ssh登陆ubantu
- git配置(用ssh)
- 用ssh加密~
- 用cygwin配置ssh
- 用注解配置ssh
- 为什么要用SSH
- SSH...
- ssh
- ssh
- ssh
- SSH
- ssh
- unity3d开发植物生长素游戏
- HBase--Java访问HBase示例
- SVN的eclipse插件下载
- KVO实现原理探究
- 使用quick自定义Button
- SSHを用いた転送
- Android View 的生命周期
- 用两个栈实现一个队列——我作为面试官的小结
- 如何将解压版的tomcat设置为windows 服务启动
- SHA1可用于检验文件是否是官方原版文件
- apache httpclient 连接 IIB,发送XML请求
- Light oj 1245 Harmonic Number (II)(基础数论)
- 12306 验证图片模式网摘思路
- DIV CSS在不同IE版本和FF以及Chrome中的兼容性差异解决方法(推荐)