Mount any cloud storage in your Linux System using “rclone”

Mount any cloud storage in your Linux System using “rclone”

Do you use One Drive or Google Drive or any other cloud storage service ? How do you access your cloud storage ? Do you use a browser to access your cloud drive files ? Or you use a client software to mount your drive ? Like One Drive application or Google Drive for desktop. Do you use multiple programs to sync your cloud storage ? Those programs will keep running in the background and eat up your system’s precious resources. What is I tell you there is a better way to access your cloud storages all in one place with a. tiny piece of application ?

What is “rclone” ?

Rclone is an all-in-one command line tool to manage your files stored in the cloud storage. It is a better way to access all your cloud services than installing their individual client applications in your system. If you are a Linux user, chances are that your cloud service provider doesn’t even provide their client application. There are some third party tools available, for example “one driver” for accessing One Drive. But there are some limitations and of course it doesn’t support all of your cloud services. That’s where rclone comes into picture.

Which cloud providers are supported by rclone ?

As of writing this article, many many and many cloud providers are supported. Those are listed below:

1Fichier Home Config,Akamai Netstorage Home Config,Alibaba Cloud (Aliyun) Object Storage System (OSS) Home Config,Amazon S3 Home Config,Backblaze B2 Home Config,Box Home Config,Ceph Home Config,China Mobile Ecloud Elastic Object Storage (EOS) Home Config,Arvan Cloud Object Storage (AOS) Home Config,Citrix ShareFile Home Config,Cloudflare R2 Home Config,DigitalOcean Spaces Home Config,Digi Storage Home Config,Dreamhost Home Config,Dropbox Home Config,Enterprise File Fabric Home Config,Fastmail Files Home Config,Files.com Home Config,FTP Home Config,Gofile Home Config,Google Cloud Storage Home Config,Google Drive Home Config,Google Photos Home Config,HDFS Home Config,Hetzner Storage Box Home Config,HiDrive Home Config,HTTP Home Config,ImageKit Home Config,Internet Archive Home Config,Jottacloud Home Config,IBM COS S3 Home Config,IDrive e2 Home Config,IONOS Cloud Home Config,Koofr Home Config,Leviia Object Storage Home Config,Liara Object Storage Home Config,Linkbox Home Config,Linode Object Storage Home Config,Magalu Home Config,Mail.ru Cloud Home Config,Memset Memstore Home Config,Mega Home Config,Memory Home Config,Microsoft Azure Blob Storage Home Config,Microsoft Azure Files Storage Home Config,Microsoft OneDrive Home Config,Minio Home Config,Nextcloud Home Config,OVH Home Config,Blomp Cloud Storage Home Config,OpenDrive Home Config,OpenStack Swift Home Config,Oracle Cloud Storage Swift Home Config,Oracle Object Storage Home Config,ownCloud Home Config,pCloud Home Config,Petabox Home Config,PikPak Home Config,Pixeldrain Home Config,premiumize.me Home Config,put.io Home Config,Proton Drive Home Config,QingStor Home Config,Qiniu Cloud Object Storage (Kodo) Home Config,Quatrix by Maytech Home Config,Rackspace Cloud Files Home Config,rsync.net Home Config,Scaleway Home Config,Seafile Home Config,Seagate Lyve Cloud Home Config,SeaweedFS Home Config,SFTP Home Config,Sia Home Config,SMB / CIFS Home Config,StackPath Home Config,Storj Home Config,Synology Home Config,SugarSync Home Config,Tencent Cloud Object Storage (COS) Home Config,Uloz.to Home Config,Uptobox Home Config,Wasabi Home Config,WebDAV Home Config,Yandex Disk Home Config,Zoho WorkDrive Home Config,The local filesystem

Unfortunately iCloud doesn’t support rclone yet, as usual. Typical Apple mentality I’d say !

How to install “rclone” ?

Installing rclone in linux is very easy. Just use the commands pertaining to your distro and package manager.

Debian or Ubuntu based systems – Linux Mint, Pop!_OS etc

sudo apt install rclone

Arch based systems – Garuda, Artix, Manjaro, EndeavourOS etc

sudo pacman -S rclone

Fedora based systems – Rocky Linux, CentOS etc

sudo dnf install rclone

For other Linux systems or Unix System (Like FreeBSD), go to the Release section of the github project page of rclone and download accordingly, or build from source by following the instructions in the rclone github page:

https://github.com/rclone/rclone

How to configure “rclone” ?

For configuring rclone, the command is very basic

Step 1 – Creating a new Remote

rclone config

After running the above command, it will show you like this:

The options are self explanatory. Press (n) to create a new remote, press (s) to set a configuration password so that no one else messes with your config.

We’ll choose the first option – (n) New Remote

Now, we’ll give it a name. Any name you want. For example, if I am configuring One Drive, I’ll put “onedrive” here, without the quotes like this:

It’s better not to put any spaces in between, because that could complicate things at a later point of time.

Now, when you press enter, you’ll see a lot of options. And I mean a lot. As of writing this article, there are 46 options here !

Select your desired cloud provider. I’d select Option 30, that’s OneDrive.

Step 2 – Client Authentication

Now, you’ll be asked client_id. If you do not know your client id that’s fine. You can proceed without it also, in that case rclone will use the default client id. The default client id might give you slow download/upload speeds. So, it’s better to use your own client id instead.

How to create your client id and client secret key and determine your cloud specific configuration ?

To get your cloud provider specific settings, open rclone website from below link:

https://rclone.org

Now, scroll down a bit until you see this:

See the “Config” buttons on the right of each entry ? Find out your cloud provider and click on the “Config” button and you’ll be presented with the configuration page for that particular cloud provider.

Now, all you need to do is to follow along the instructions to generate your client id and client secret for your cloud provider and keep it handy with you. You’ll need it in the next step.

Now, in the following screen, enter your client id

Then press “Enter” and similarly, enter your client secret when prompted

Again, these are optional steps. If you don’t have the client id and client secret, it’s absolutely fine too.

Now, it will prompt you to select region

Most of the cases, option 1 is all you want. Because you can already guess that the other 3 options are not for most of us users. Except who are from Germany. Then it’s option 3 for you.

No, I do not want to edit advanced config. If you want to explore, it’s fine. Otherwise just press “Enter” without selecting anything because it’s “no” by default.

Press “Enter” in the next screen. Auto-config should be sufficient for you if you are using a GUI desktop like XFCE or KDE or GNOME or any other Desktop Environment, you will get an authorization screen like this:

If it doesn’t open your browser automatically, see the link in the console which starts with http://127.0.0.1:53682 as shown in the below screenshot ? copy the whole url and paste it in your browser.

Then, after you login to your Microsoft Account, you’ll get this success screen.

If you are not using any Desktop Environment or you’re connecting to your Linux system with SSH, you need to select the “Headless” option. So, in the “Autoconfig” screen, select “No” and you’ll get the following screen

As you can see from the instructions on the screen, you need to go to your other machine which has a browser installed and also rclone should be installed on that 2nd machine. Then copy and paste the command written on the console like this:

It will ask you to login to your Microsoft account, and after Login, you’ll get this screen:

Click “Continue” and you’ll get a “Success” screen like before:

Now, you’re not done yet, check the terminal on your second machine, you’ll see a code there which will look like this:

Copy the code and paste in your first machine where it was asking for the “config_token”:

Press “Enter” and you’ll see the below screen

Select option 1. That should be applicable for almost everyone.

Select option 1 again

Press “Enter”. By default it will select “Yes”.

Press “Enter” Once again, so that all your changes are saved now.

Now, we can see our “onedrive” remote is showing. If you’re using any other cloud provider, the steps should be more or less similar, unless you are a very advanced user. In that case you’ll not need this tutorial anyway.

Step 3 – Mounting the cloud drive

Now, we’ll mount our cloud drive to a folder so that we can access it easily. Let’s see how to do that.

First we’ll create the directory where we will mount our cloud drive.

mkdir ~/onedrive

You can mount it wherever you want.

Now, we’ll use the following command to mount our onedrive.

rclone mount onedrive: ~/onedrive

As we can see our onedrive is mounted and the cloud files are showing.

But, there is a catch, your terminal is still running, and if you close the terminal, it will unmount your onedrive as well.

So, we need to run this in the background. It’s very easy. Just put a “&” at the end of the mount command.

rclone mount onedrive: ~/onedrive &

Now, it will keep running in the background.

Step 4 – Troubleshooting

If you get the following error:

You can try to unmount the existing drive with the following command

fusermount -u /home/qube/onedrive

If the above command fails to unmount and gives any error like this

Use the –allow-non-empty flag while mounting like this:

rclone mount onedrive: ~/onedrive --allow-non-empty &

If you are getting this following error:

Make sure to own the directory. To do this, use the following command

sudo chown qube:qube /home/qube/onedrive

Replace my username “qube” with your username and my group name “qube” with yours. Also, check the mount folder name as well.

To Kill all rclone processes, run this command

pkill -f rclone

That’s all you need to configure rclone in your Linux system. Let me know in the comments section if you’re facing any issues.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *