OpenWrt - few newbie questions

Discussion in 'ZIDOO X9S' started by Alelino, Jan 3, 2018.

  1. Alelino

    Alelino New Member

    hi all and a happy new year to everybody.

    I got this wonderful Xmas present, and after playing a bit with the internal OS I’ve decided to take advantage of the embedded OpenWrt to set up different services in my house.

    Problem is, I find very difficult to get information... I can’t find info on the zidoo’s website, and the OpenWrt wiki is either too technical or the procedures suggested are different with the implementation on the x9s (eg Netatalk)

    Does anyone knows where to find some good, structured info?
    My actual problems are:

    - how do I configure user-based access to samba shares? I need to allow authenticated access to different shares.
    - how do I disable samba auto mount for certain shares?
    - how do I define a different name for the share than the one given automatically (disk_sdaN)?
    Even if I change the name in the web interface, the next reboot will reset the names and remount all the shares
    - how do I set up time machine server? I configured the web ui, but it doesn’t advertise the server on the network, so my macs cannot discover the drive.

    Many thanks in advance, and again a wonderful year to everyone!
    Alelino
     
  2. n_p

    n_p Active Member

    It will not get less technical. :)

    Never touched the openwrt part of the X9s, but used many routers running OSes based on it, so here are a few pointers.

    In my current router there is no multi user interface for samba in the gui either. Samba is one user, for the entire share. The ftp sharing option (/server) allows multi user configurations from the gui though.
    -

    That said, what you want to do should be possible by manually editing the samba config file, as described here: https://forum.openwrt.org/viewtopic.php?id=27066

    Here is how that works on a base level. :)

    All that the openwrt GUI (graphical user interface) does is to translate your name entries, and checkbox clicks into a config file, and then hook into the startup process, starting the samba server with said config file. If you disable "samba sharing" in the GUI - you can still write a custom config file, and tell the openwrt part of the X9S, to launch the samba server, with your specific config file.

    The way youd do this is by writing a startup script. Openwrt usually allows you to write and save one directly in the gui (there should be a place somewhere in the options.. ;) ).

    The way you'd structure that script is -

    - start with a delay - lets say 30 seconds, before the script does anything, so you can make sure it runs, after everything else ran after startup. Especially after the drives are mounted.
    - kill the samba server process (if it is running)
    - copy your own .config file over the .config file thats already there (in case it gets newly created on each startup. you'd save your config file somewhere else (different folder/different name), then copy it over at this stage
    - start the samba server with your config file

    Now, you cant write the entire script from scratch (you probably could write the config file "from scratch" - with the information from the wiki. :) ), so you try and test each of the steps on the system first. You'll do that via the command line - ie. talking to your openwrt x9s system via ssh.

    ssh usually has to be enabled in the openwrt options, after that - you should be able to ssh "in to the device" via an ssh client (putty is the most well known one for windows). What you get by "sshing into the device" is basically a command line window, that "runs" on the device.

    From there you can try to list all running processes, kill the samba process, launch the samba process with a certain config file, look at the file system on the device, look at the samba config thats already on the device, create new folders, copy or create new files, textedit a new config file... and so on.

    The commands you'd use are all linux shell commands, as a texteditor to use via command line, I'd recommend nano - for first time users. If nano is not on the system, installing it might become complicated (or not... at that stage (if you should get that far.. ;) ) ask one of the mods or devs in here that might know. :) ).

    To copy files over to a system "using ssh" you use scp (which is not ssh ;) ). (That would allow you to create the config file on a PC and the copy it over f.e.)

    Once you've found the correct commands to kill and launch the samba process, and to copy the config file you created over the default samba config file, and have successfully launched samba with the new config file - you can go back to the openwrt gui, and write the startup script. The commands are the same - you write them in the startup script field, like you'd write them in the command line.

    (Dont forget to add a large delay (sleep 30) at first, use enter to separate the commands (each new line is a new command), learn the syntax, that only runs a command if the last one ran successfully ( && ), ... )

    That way you could kill (if needed) and (re)start the samba process with a custom config you wrote, automatically each time the X9S would start.
    -

    As far as the announcement issue goes - at least on earlier versions of OSX you could click on any free space on the the desktop, then press cmd+k and manually connect to any smb or ftp server you'd like.

    Openwrt usually does announce its SMB servers though - or at least should have the option, not sure, why it doesnt show up on your mac automatically.

    Time Machining to a smb share, may not be a trivial thing either - If I remember correctly, Apple might not allow that as a default. For afair good reasons. :)

    edit: On my current router (not a Zidoo product), I had to do something similar to get an optware version of transmission to work as needed - so here is the startup script I used in that case - to give you a little orientation:

    Code:
    sleep 35
    killall transmission-daemon
    sleep 1
    cd /tmp/mnt/Passport/torrents
    cd .settings
    cp settingsbackup.json settings.json
    sleep 1
    /opt/bin/transmission-daemon -g /mnt/Passport/torrents//.settings
    echo done
    
    so

    - add a delay (sleep)
    - kill the already running transmission process (killall process name)
    - navigate to the settings folder
    - copy my settings file over the default one
    - launch the transmission process with said config file (the transmission process allows you to feed a config directory - where it the searches for the default config file name, and loads that file, so Im specifying the directory in that case - you should expect this to be entirely different in case of the samba server - youd have to find out. :) )
    - write "done" (youd only see that in log files :) )
     
    Last edited: Jan 5, 2018
    videobruce likes this.
  3. Alelino

    Alelino New Member

    Well, for sure you gave me something to do, this weekend.

    Thanks, mate.
     
  4. n_p

    n_p Active Member

    It might not be very rewarding at first - because it can be quite a bit of hit and miss - and I've not detailed all the steps (use the ps command and grep (which you "pipe to" (phrase for google.. ;) ) |) to find out what the process name is, save your modified config file at a place you've got write permissions to and that doesnt get deleted on restart (might have to be the harddrive acctually, I dont know.. :) ) - but it should be doable. :)

    Also - you'll learn some valuable basics for working with Linux(/Unix) systems over ssh.

    This is how most of them work btw. That samba client you are trying to run with a custom config? Someone wrote that. That texteditor (nano) you might use to edit your config file - someone else wrote that. Openwrt took some of those packages, based on needs and a small performance footprint and packaged them, so they could provide a featureset - now that community is maintaining that.

    The only point I'm going to raise, is that in a linux environment (like openwrt) its usually also "easy" to add new packages and libraries if you should need them (referred to as otpware in openwrt circles ;) ), and because the X9S (or Zidoo boxes in general) are a hybrid in that regard, and its devs may or may not be willing to support their customers to that granular of a level - it might not be the easiest thing to install new modules on that thing (like a "new samba server" (not that you need one, just as an example).

    The community you should hit up to learn this stuff definitely is on the openwrt forums - and getting this stuff to work can be a bit of a hassle at first (when I did my current router setup, I cursed for two days straight.. ;) ), but ultimately - it works, it works on a very low power footprint, and it usually is tested and stable, and very "malleable" to your needs. :)

    That Zidoo went with it is both great, and insane at the same time - because their audience definitely isnt into this to learn Linux/Network admin stuff, alongside with "installing a recommended Android app from the Play Store". ;)


    If you need it a step easier - look into the ftp server first. It should be mostly configurable withing the gui, should allow for a multi user setup, and can be implemented in Windows and most other OSes "largely" the same way. (Depending on what you'd need from it.)

    If you want different people to be able to access different "folders" on the same harddrive, that all can be done over ftp as well. The hardest part to that - maybe would be to make them use an ftp client. :) (Look at Total Commander on windows, or Forklift on MacOS, still like them very much... - and they "hide" a bit of the ftp "complexity". :) ) If you'd like to sync certain folders, there are programs that should be able to do that over ftp too...
     
    Last edited: Jan 6, 2018

Share This Page