Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOW TO: VirtualBox Alpine Linux + rclone + samba share #2

Open
ajkis opened this issue Jan 28, 2017 · 14 comments
Open

HOW TO: VirtualBox Alpine Linux + rclone + samba share #2

ajkis opened this issue Jan 28, 2017 · 14 comments

Comments

@ajkis
Copy link
Owner

ajkis commented Jan 28, 2017

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.

@Powerbless
Copy link

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?

@ajkis
Copy link
Owner Author

ajkis commented Feb 27, 2017

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

@Powerbless
Copy link

Powerbless commented Feb 27, 2017

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

@ajkis
Copy link
Owner Author

ajkis commented Feb 27, 2017

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

@Powerbless
Copy link

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

@ajkis
Copy link
Owner Author

ajkis commented Feb 27, 2017

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

@Powerbless
Copy link

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

@ajkis
Copy link
Owner Author

ajkis commented Feb 27, 2017

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.

@Powerbless
Copy link

Powerbless commented Feb 27, 2017

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
Copy link

Powerbless commented Feb 27, 2017

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
Copy link

Powerbless commented Feb 28, 2017

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
Copy link

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
Copy link

how can i run "modprobe fuse" on startup?

@gnolascord
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants