scripts icon indicating copy to clipboard operation
scripts copied to clipboard

HOW TO: VirtualBox Alpine Linux + rclone + samba share

Open ajkis opened this issue 8 years ago • 14 comments

Download & Install Virtualbox host: https://www.virtualbox.org/wiki/Downloads Download Alpine Linux Standard: https://www.alpinelinux.org/downloads/

Open Virtualbox and create new virtual machine:

Type: Linux Version: Other Linux (64 bit) Base Memory ( 1024MB + i would recomment at least 2048 ) Storage: 1GB dynamically allocated ( after rclone+samba etc it would still be bellow 500MB) Storage Optical: Connect alpine ISO image. Network: Bridged Adapter ( so you can assign your own static IP ) Disable Audio, Serial ports

Boot created virtual machine and once in terminal mode setup your hostname, ip, dns by typing:: setup-hostname setup-interfaces setup-dns After restart network: /etc/init.d/networking restart

Setup the Alpine Linux on your HDD setup-alpine

Update Alpine: apk update apk upgrade

Install fuse apk add fuse

Optional apk add unionfs-fuse

Install Samba apk add samba samba-common-tools

Before setting up rclone install certificates

mkdir -p /etc/ssl/certs/ curl -o /etc/ssl/certs/ca-certificates.crt https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt ntpclient -s -h pool.ntp.org

Setup rclone and mount folders

Share rclone mount in samba by adding special samba user and creating smb.conf

Create new user: adduser --no-create-home --disabled-password --disabled-login mysambauser smbpasswd -a mysambauser

Create config vi /etc/samba/smb.conf

[global]
   workgroup = WORKGROUP
   dos charset = cp850
   unix charset = ISO-8859-1

[cloud]
  comment = TV backup
  path = /path to rclone mount /
  browsable = yes
  writable = yes
  read only = no
  guest ok = no
  write list = mysambauser
  read list = mysambauser
  valid users = mysambauser

Add samba to run at startup rc-update add samba Start samba; rc-service samba start

You may consider adding your rclone mount script to boot in local.d so add it to boot by: rc-update add local default

Now you can make new rclone mount script in vi /etc/local.d/rclonemount.start

#!/bin/bash rclone mount
--read-only
--allow-non-empty
--allow-other
--max-read-ahead 14G
--acd-templink-threshold 0
--checkers 16
--quiet
--stats 0
rcloneremote:/ /path to mount/ & exit

vi /etc/local.d/rclonemount.stop

#!/bin/bash fusermount -uz /path to mount/ exit

You can read more about local.d : cat /etc/local.d/README

Optionally you can enable SSH and run virtualbox in headless mode

To enable SSH vi  /etc/ssh/sshd_config Set : PermitRootLogin yes restart SSH /etc/init.d/sshd restart

To start your virtalmachine in headless mode, create new batch file with content bellow:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "alpine" --type "headless" exit

To stop or better yet stop and save last state you can make batch:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "alpine" savestate exit

Once your virtalbox machine is running you can access it by typing in windows explorer: \THE IP\NameOfShare ( in our case cloud ) use username and password you set for samba.

ajkis avatar Jan 28 '17 19:01 ajkis

thank you for your tutorial! But i can only read the mount in windows. in linux i can create folders and files but when i connect to the smb trough windows then i can only read. have you any idea?

Powerbless avatar Feb 27 '17 12:02 Powerbless

What kind of error do you get ? Maybe enable fuse debugging on rclone mount and check in logs.

ajkis avatar Feb 27 '17 17:02 ajkis

i have another problem.

i have installed your linux etc...but wenn i will rclone config, i can not copy the secure_token in the vm. the copy stops at the half and abort

he say: unexpected end of JSON input

Powerbless avatar Feb 27 '17 19:02 Powerbless

You did not copy paste file correctly a part of it its missing. I suggest you SFTP it to your VM.

ajkis avatar Feb 27 '17 19:02 ajkis

how can i do that? i have often used SFTP programs but not to send to a vm. can you give me a tipp?

Powerbless avatar Feb 27 '17 20:02 Powerbless

Well your VM have an IP just SSH to it dont use the VM terminal directly.

ajkis avatar Feb 27 '17 20:02 ajkis

when i try to connect with putty he say i musst login. i type user "root" and the pw "root" but...access denied.

the login trough the vm with root and root works fine

Powerbless avatar Feb 27 '17 20:02 Powerbless

Is Pass auth enabled in /etc/ssh/sshd_config

p.s. You could word wrap your rclone config so you make sure its copy pasted correctly.

ajkis avatar Feb 27 '17 20:02 ajkis

yes i have enabled how you have write this in your tutorial above. i deleted the # and the passwd*** and type "yes" behind PermitRootLogin edit: login with SSH now works! i had an empty password. now with password it works

what do you mean with wordwrap?

Powerbless avatar Feb 27 '17 20:02 Powerbless

now, i have rclone conigured! Thx :-)

that mean when i connect in windows to \\pcname\cloud

then he ask me for user and password. but there not correct. how can i now create a new user or change the old?

Powerbless avatar Feb 27 '17 21:02 Powerbless

update: now i can access from windows to the smb share!

now the problem: i see all the files on ACD but i have no write permissions. i have only read permissions...bevore i mount the folder trough rclone (/media/ACD" i can create folders and files trough the share...but with rcloune mounted i have only write permissions

edit: i have it! i have added in smb.conf: force user = root

Powerbless avatar Feb 28 '17 05:02 Powerbless

when i type: rc-update add local default he says:

  • rc-update: local already installed in runlevel `default'; skipping

and autostart does not work

Powerbless avatar Mar 09 '17 09:03 Powerbless

how can i run "modprobe fuse" on startup?

Powerbless avatar Apr 06 '17 15:04 Powerbless

i try to install rclone but gets following error: curl: (23) Failed writing body (0 != 959

gnolascord avatar Feb 27 '18 18:02 gnolascord