{"id":187,"date":"2014-01-17T18:53:17","date_gmt":"2014-01-17T15:53:17","guid":{"rendered":"http:\/\/meekconsulting.com\/?p=187"},"modified":"2022-01-08T16:26:32","modified_gmt":"2022-01-08T13:26:32","slug":"using-rsync-to-backup-windows-files-to-linux-server","status":"publish","type":"post","link":"https:\/\/meekconsulting.com\/?p=187","title":{"rendered":"Using rsync to backup windows files to linux server"},"content":{"rendered":"<p>I set up my fathers windows PC to backup his pictures to my linux server using the following steps:<\/p>\n<p>Download grsync for windows from here: <a href=\"http:\/\/sourceforge.net\/projects\/grsync-win\/\">http:\/\/sourceforge.net\/projects\/grsync-win\/<\/a><\/p>\n<p>From Command Prompt set up \u201cpublic\/private key pair\u201d<\/p>\n<blockquote><p>cd C:\\Program Files\\Grsync\\bin<\/p>\n<p>ssh-keygen<\/p><\/blockquote>\n<p>Just take defaults and it saves the id_rsa.pub and id_rsa.key to a .ssh directory under you windows User directory.<\/p>\n<p>Next Copy this file up to the server using the scp command (comes with grsync)<\/p>\n<blockquote><p>scp -p22 c:\\Users\\USERNAME\\.ssh\\id_rsa.pub username@linux_hostname_or_ip:\/tmp<\/p><\/blockquote>\n<p>Then from the linux server put the id_rsa.pub file contents in \/home\/username\/.ssh\/authorized_keys file<\/p>\n<blockquote><p>mkdir \/home\/username\/.ssh<br \/>\ncat \/tmp\/id_rsa.pub > \/home\/username\/.ssh\/authorized_keys<br \/>\nchmod 600 \/home\/username\/.ssh\/authorized_keys file<\/p><\/blockquote>\n<p>Then test to see if you can get in without password prompt using ssh command<\/p>\n<blockquote><p>ssh.exe -p22 username@linux_hostname_or_ip<\/p><\/blockquote>\n<p>If it lets you in without a password you\u2019ve got it configured properly and are ready to use rsync to back it up<\/p>\n<p>Now make a batch file called mybackup.bat file with this command (ALL ON ONE LINE)<\/p>\n<blockquote><p>C:\\Program Files\\Grsync\\bin\\rsync -az \u2013progress \u2013rsh=\u201d.\/ssh.exe -p22\u2033 \/cygdrive\/c\/PATH_ON_C_TO_SYNC username@linux_hostname_or_ip:\/PATH_TO_SERVER_LOCATION<\/p><\/blockquote>\n<p>When you run the bat file the first time it will copy everything.<\/p>\n<p>If you run later it will copy only the changed files.<\/p>\n<p>You can add this bat file to a scheduled job to have an automated backup process.<\/p>\n<p><strong>NOTE: The -p22 reference is specifying the default port 22 for ssh \u2014 change it if you have configured SSH to listen on a different port.<\/strong><\/p>\n<p>Also \u2014 Make sure your firewalls are open to allow incoming SSH traffic on the specified port on the server location.<\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I set up my fathers windows PC to backup his pictures to my linux server using the following steps: Download grsync for windows from here: http:\/\/sourceforge.net\/projects\/grsync-win\/ From Command Prompt set up \u201cpublic\/private key pair\u201d cd C:\\Program Files\\Grsync\\bin ssh-keygen Just take &hellip; <a href=\"https:\/\/meekconsulting.com\/?p=187\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[12],"_links":{"self":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/187"}],"collection":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=187"}],"version-history":[{"count":4,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/187\/revisions"}],"predecessor-version":[{"id":192,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/187\/revisions\/192"}],"wp:attachment":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}