| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
xdld
9年前发布

通过SSH自动同步文件或目录:sshync

通过SSH自动同步文件或目录,使用 fs.watch().

配有一个极好的工具sshpair生成一个公共SSH密钥。

echo -e "y\n" | ssh-keygen -q -N "" -f ~/.ssh/sshync

and writes the result to~/.ssh/authorized_keyson the remote host. This prevents the password prompt from showing up every time we sync.

Ignore paths by adding them, one per line, to a file named.sshyncignorein the providedsourcefolder.

安装

$ npm install sshync -g

使用

# generate a public SSH key (so we don't have to retype password)  # write to user@ip:~/.ssh/authorized_keys    $ sshpair <user@ip[:port]>    # initialize file auto-sync  $ sshync <user@ip[:port]> <source> <destination>            source:       local source folder.            destination:  remote destination folder.

示例

$ git clone https://github.com/mateogianolio/sshync.git  $ cd sshync  $ sshpair root@xxx.xxx.82.203  generated ssh key to ~/.ssh/sshync.pub  root@xxx.xxx.82.203's password:  root@xxx.xxx.82.203's password:  ~/.ssh/sshync.pub => ~/.ssh/authorized_keys    $ echo -e ".git\nnode_modules" > .sshyncignore  $ sshync root@xxx.xxx.82.203 . /root/sshync  . => root@xxx.xxx.82.203:/root/sshync    ignore ./.sshyncignore  mkdir -p /root/sshync  [+] ./README.md => /root/sshync/README.md [399 bytes]  [+] ./package.json => /root/sshync/package.json [520 bytes]  [+] ./sshync.js => /root/sshync/sshync.js [3304 bytes]  [+] ./LICENSE.md => /root/sshync/LICENSE.md [1084 bytes]  # ... edit package.json ...  [/] ./package.json => /root/sshync/package.json [524 bytes]

项目主页:http://www.open-open.com/lib/view/home/1442980750201

 本文由用户 xdld 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1442980750201.html
sshync