Complete guide to go to hell and back. ยฉ @Lion ๐
Install google-drive-ocamlfuse on Debian Jessie and later.
su
apt-get install software-properties-common sudo ssh
exit
Continue with sudo:
sudo apt-get install opam ocaml make fuse camlp4-extra build-essential pkg-config
Create fuse group (if not already present):
sudo groupadd fuse
Debian has a special user group to allow fuse access. Log out, and log back in after this to make change effective:
Replace
*username*
with your real username
sudo usermod -a -G fuse *username*
sudo chown root:fuse /dev/fuse
sudo chmod 660 /dev/fuse
opam init
opam update
opam install depext
eval `opam config env`
opam depext google-drive-ocamlfuse
opam install google-drive-ocamlfuse
. /home/*username*/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
Yes, do it.
sudo reboot
Source: https://github.com/astrada/google-drive-ocamlfuse/wiki/Headless-Usage-&-Authorization
- Sign in to your Google account and create a project: https://console.cloud.google.com/
- Click "API Manager" then "Library" in the left-hand pane (will take you to https://console.cloud.google.com/apis/library). Click on "Drive API", then "ENABLE API".
- Click "Credentials" in the left hand pane, then click on the button "Create Credentials" (OAuth client ID)
- Choose "Other"
- Choose any product name, e.g "My OCAMLDrive".
- Click "Create". You will get a Client ID, a Client Secret.
- Authorization: Back in your headless server, run google-drive-ocamlfuse for the first time. I used labels (in this document, I use the label "me") because I plan on using multiple accounts. However you can also run it without the -label parameter and it will use a default name for the label called "default". You will need the Client ID and secret you got from google above.
From version 0.5.3, you should use the -headless option:
Replace
*yourClientID*
and*yourSecret*
with your real credentials
google-drive-ocamlfuse -headless -label me -id *yourClientID*.apps.googleusercontent.com -secret *yourSecret*
Example output:
Please, open the following URL in a web browser: https://accounts.google.com/o/oauth2/auth?client_id=##yourClientID##.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force
Then, you should open the URL above in a graphical web browser, get the verification code from Google and put it here:
Please enter the verification code:
That's it. You should be ready to mount.
Replace
*username*
with your real username
mkdir /home/*username*/gdrive
Try mount:
google-drive-ocamlfuse -label me /home/*username*/gdrive
You need mount script and service configuration
Source/tips: https://linuxconfig.org/how-to-automatically-execute-shell-script-at-startup-boot-on-systemd-linux
cd /user/local/bin
nano mount-gdrive.sh
Type script content:
Replace
*username*
with your real username
#!/bin/sh
su *username* -l -c "google-drive-ocamlfuse -label me /home/*username*/gdrive"
Fix permission:
chmod 755 mount-gdrive.sh
Go to systemd directory:
cd /etc/systemd/system
nano gdrive.service
Type in file content:
[Unit]
After=networking.service
[Service]
ExecStart=/usr/local/bin/mount-gdrive.sh
[Install]
WantedBy=default.target
Configure service:
chmod 664 /etc/systemd/system/gdrive.service
systemctl daemon-reload
systemctl enable gdrive.service
Test your configuration:
systemctl start gdrive.service
GG WP ๐ฎ ๐ ๐ โ
Thanks you a lot for this manual!
It was little bit difficult for me (I'm new in Linux, my first week on Linux Debian :)) but I completed it successfully :D. I run this process on Debian 11 "Bullseye".
Also I found that steps at https://console.cloud.google.com/ was changed. Before creating credentials google required to create first OAuth project. During project configurations need to add your email to the testers users list, otherwise it will be not work.
Then you will be able to create new credentials. Also no more option "Other", I chose "Desktop" and it's worked for me.
That's all :)