想要让 Google Drive 在 Linux 上自动挂载,而 Google Drive 的官方客户端不支持 Linux 系统,这里使用第三方工具 rclone
和 google-drive-ocamlfuse
。
Google API & OAuth2
- Check Reference for more details.
- Create Google API project
- Create OAuth2 Client ID
- Application type: Desktop app
- save
client_id
and client_secret
- Add users in OAuth Users in Test (7 days) or Publish App
rclone
install
1 2 3 4 5 6 7 8 9 10 11
| curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip unzip rclone-current-linux-amd64.zip cd rclone-*-linux-amd64
sudo cp rclone /usr/bin/ sudo chown root:root /usr/bin/rclone sudo chmod 755 /usr/bin/rclone
sudo mkdir -p /usr/local/share/man/man1 sudo cp rclone.1 /usr/local/share/man/man1/ sudo mandb
|
exec
FAQ
- fusermount: option allow_other only allowed if ‘user_allow_other’ is set in/etc/fuse.conf
google-drive-ocamlfuse
install
1 2 3
| sudo add-apt-repository ppa:alessandro-strada/ppa sudo apt-get update sudo apt-get install google-drive-ocamlfuse
|
mount
- exec below command to get
verification_code
1
| google-drive-ocamlfuse -debug -headless -id `client_id` -secret `client_secret`
|
- write
verification_code
in ~/.gdfuse/default/config
- create mountpoint:
mkdir ~/GoogleDrive
- mount:
google-drive-ocamlfuse ~/GoogleDrive
- check via
df -h
FAQ
- ls: cannot access ‘GoogleDrive’: Input/output error
1
| fusermount -u ~/GoogleDrive
|
- ls: cannot access ‘GoogleDrive’: Transport endpoint is not connected
1
| fusermount -u ~/GoogleDrive
|
- SOCKS5 Connect Timeout
1 2
| export https_proxy=http://127.0.0.1:7890 export http_proxy=http://127.0.0.1:7890
|
Reference
本文作者:jujimeizuo
本文地址: https://blog.jujimeizuo.cn/2025/05/21/mount-google-drive-on-linux/
本博客所有文章除特别声明外,均采用 CC BY-SA 3.0 协议。转载请注明出处!