Skip to content
iwonbigbro edited this page Sep 30, 2013 · 7 revisions

The intention is that GSync will provide as much of if not all of the same upload and download functionality of RSync, excluding the transport, encoding layers and daemon support of course. So for a full explanation of how to use GSync, you could refer to the RSync man page. However, a demonstration of some use cases are shown below.

Authenticating with your Drive

Authentication is handled by the Google OAuth2 authentication layer. It works in much the same way as any Android application, which has to obtain permission to access features of your device. The difference is that the applications that use oauth2 have to request explicit permission to access your Google services, like GMail, Drive, Calendar and so on. In order to do that, a special permissions token has been generated for this application (which currently is not perpetual so has a limited lifetime; I'll regenerate a new one when the current one runs out). This token is used to request authorisation from you to allow an application using this token to access your Google Drive. However, the token is only permitted when combined with a unique authorisation token that you will get from Google once you have granted permission for GSync to access your drive. This token is then stored in your home directory on the computer you run GSync from, under ~/.gsync. If you remove the ~/.gsync directory, it will remove the cookie and you will need to regenerate a new authentication token. Here is how the process would look:

$ time gsync --owner --group --progress --perms -u -d -r -vi ~/tmp/gsynctest/Debian_Flamme2.jpg drive://unittest/
Warning: Not running as root, file ownership may be ignored
Authorization is required to access your Google Drive.
Navigate to the following URL:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=542942405111.apps.googleusercontent.com&access_type=offline
Type in the received code: 

If you navigate to the URL provided, you will see something like this:

Authentication

If you accept, you will see a unique authentication token appear that you must paste into the awaiting prompt. Once done, the cookie is created and authentication need only take place if the cookie is removed or when the token expires.

Note: The authentication message will only appear when data is required to be transferred to or received from your Google Drive. If you do not specify any local files to transfer, the authentication steps shown above will not appear.

Clone this wiki locally