# Install RClone | webally.co.za

# Install RClone

curl https://rclone.org/install.sh | sudo bash

Then when it's done installing, execute the following command:

rclone config

Now it will prompt you to add a (n) new remote service. Answer n
Now it will prompt you to add a (n) new remote service. Answer n

Now it asks for a name for tour new remote, you can name it anything but just remember what you name it. Enter name
Now it asks for a name for tour new remote, you can name it anything but just remember what you name it. Enter name

Now it wants you to find the service in a list, in my case it was nr 22 OneDrive. Enter 22
Now it wants you to find the service in a list, in my case it was nr 22 OneDrive. Enter 22

Now it will ask you for your microsoft App Client Id and client secret, you don't have to enter anything. Enter, Enter, Enter
Now it will ask you for your microsoft App Client Id and client secret, you don't have to enter anything. Enter, Enter, Enter

Edit Advanced Config? (y/n).  Enter n
Edit Advanced Config? (y/n). Enter n

Use auto config. Enter y
Use auto config. Enter y

That will open a website to OneDrive to Login with your normal OneDrive credentials
That will open a website to OneDrive to Login with your normal OneDrive credentials

If at this point you can't open a browser because you're in a terminal then don't worry, there is a way around this.

Once you've entered your credentials you'll get a confirmation email
Once you've entered your credentials you'll get a confirmation email

Select the share applicable to you in the list. Enter 1
Select the share applicable to you in the list. Enter 1

Then choose a drive to use. Enter 0
Then choose a drive to use. Enter 0

That is that for the config. Choose q
That is that for the config. Choose q

Mount network drive
Mount network drive

But to let the command run every time the server start, add the command to /etc/rc.d/rc.local

nano /etc/rc.d/rc.local

Add the following command to the end of the file, where one is the name you have the share in step 2 and /var/one is where you want your onedrive to mount.

# /etc/rc.d/rc.local
rclone --vfs-cache-mode writes mount one: /var/one

# Mounting the drive on Startup with systemctl service

nano /etc/systemd/system/rclone.service

Copy and Paste the folowing

[Unit]
Description=OneDrive (rclone)
AssertPathIsDirectory=/var/one

After=network.service

[Service]

Type=simple
ExecStart=/usr/bin/rclone mount \
        --config=/root/.config/rclone/rclone.conf \
        --allow-other \
        --cache-tmp-upload-path=/tmp/rclone/upload \
        --cache-chunk-path=/tmp/rclone/chunks \
        --cache-workers=8 \
        --cache-writes \
        --cache-dir=/tmp/rclone/vfs \
        --cache-db-path=/tmp/rclone/db \
        --no-modtime \
        --drive-use-trash \
        --stats=0 \
        --checkers=16 \
        --bwlimit=40M \
        --dir-cache-time=60m \
        --cache-info-age=60m one:/ /var/one

ExecStop=/bin/fusermount -u /var/one
Restart=always
RestartSec=10

[Install]

WantedBy=default.target

Then run the following command that will run the service and enable to add it to the startup

systemctl start rclone
systemctl enable rclone