Linux用Rclone挂载谷歌盘
4diu0diu4- 安装rclone
wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh
- 配置谷歌盘步骤记录(跟着做不会错)
SSH内输入:rclone config 选n 新建 name>输入Rakuen 选[13]是谷歌硬盘 client_id> Enter跳过(有的话可以填自己的,不懂的直接Enter跳过) client_secret> Enter跳过 (有的话可以填自己的,不懂的直接Enter跳过) scope> Enter默认 root_folder_id> Enter默认 service_account_file> Enter跳过 Edit advanced config? (y/n)> 是否配置高级选项,选n Use auto config?> 是否自动配置,选 n 然后出现 Please go to the following link: https://accoun************* 你就复制那段网址到浏览器里打开,登录账号,授权允许,会给你一串验证码,复制它 Enter verification code> 粘贴复制来的那段验证码 Configure this as a team drive?> 如果要挂载个人盘就选n,挂载团队盘选y 然后输入Rakuen团队盘的编号比如10,瞧仔细了,是0AOMu*****k9PVA那个对应的编号。 Yes this is OK (default)> y Rclone就配置完毕了
然后我们开始挂载
- 新建挂载目录Rakuen
mkdir /home/Rakuen
- 挂载方案1:手动挂载(不推荐)
#手动挂载,下面的DriveName、Folder、LocalFolder参数根据说明自行替换
rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 #DriveName为初始化配置填的name,#Folder为Google Drive里的文件夹, #LocalFolder为VPS上的本地文件夹。
挂载成功后,输入df -h命令查看即可!
#卸载磁盘命令
fusermount -qzu LocalFolder
- 挂载方案2:开机后台自动挂(推荐)
#先新建systemd配置文件,适用CentOS 7、Debian 8+、Ubuntu 16+。
以下是一整条命令,直接一起复制到SSH客户端运行
cat > /etc/systemd/system/rclone.service <<EOF [Unit] Description=Rclone AssertPathIsDirectory=LocalFolder After=network-online.target [Service] Type=simple ExecStart=/usr/bin/rclone mount Rakuen: /home/Rakuen \ --umask 0000 \ --default-permissions \ --allow-non-empty \ --allow-other \ --buffer-size 32M \ --vfs-read-chunk-size 64M \ --vfs-read-chunk-size-limit 1G ExecStop=/bin/fusermount -u /home/Rakuen Restart=on-abort User=root [Install] WantedBy=default.target EOF
#重载配置文件
systemctl daemon-reload
#开始启动:
systemctl start rclone
#设置开机自启:
systemctl enable rclone
#其他命令:
重启:systemctl restart rclone 停止:systemctl stop rclone 状态:systemctl status rclone