Linux – How to mount a Windows share in OpenDreambox via Telnet

command linelinuxnetwork-sharestelnet

I have created a new folder on root of C disk called recordings and I have shared it with everyone. I now want to mount this folder on my Dreambox so that I can record to it.

But since this is an original Dream Multimedia box with Enigma2 I don't have the options Network Browser or Mount Manager in the network settings menu so I can't do this easily via the menu, not without changing the image of the Dreambox.

I have read that it's possible to mount it through Telnet. So how exactly do I do that? What command or commands do I use?

I have found these two commands on the web:

Example 1:

mount –t cifs –o username=name,password=password //192.168.1.10/dreambox

Example 2:

mount -t smbfs -o username=YourUserName //x.x.x.x/YourShareName /your/mountpoint

Can I use any of these two commands? Why does it say cifs in one and smbfs in the other? What do those switches mean? And also, do I have to do this every time I reboot or is this a permanent setup?

I connect to the Dreambox with PuTTYtel and it presents itself as OpenDreambox 1.6.0.

Update: Here is the output of PS command in PuTTYtel.

OpenDreambox 1.6.0 dm500hd

dm500hd login: root
root@dm500hd:~# ps
  PID USER       VSZ STAT COMMAND
    1 root      1724 S    init [3]
    2 root         0 SW   [migration/0]
    3 root         0 SWN  [ksoftirqd/0]
    4 root         0 SW   [migration/1]
    5 root         0 SWN  [ksoftirqd/1]
    6 root         0 SW<  [events/0]
    7 root         0 SW<  [events/1]
    8 root         0 SW<  [khelper]
    9 root         0 SW<  [kthread]
   10 root         0 SW<  [kblockd/0]
   11 root         0 SW<  [kblockd/1]
   12 root         0 SW<  [khubd]
   13 root         0 SW   [pdflush]
   14 root         0 SW   [pdflush]
   15 root         0 SW<  [kswapd0]
   16 root         0 SW<  [aio/0]
   17 root         0 SW<  [aio/1]
   18 root         0 SW<  [ata/0]
   19 root         0 SW<  [ata/1]
   20 root         0 SW<  [ata_aux]
   21 root         0 SW<  [scsi_eh_0]
   22 root         0 SW<  [scsi_eh_1]
   23 root         0 SW   [mtdblockd]
   24 root         0 SWN  [jffs2_gcd_mtd3]
   70 root      2180 S <  udevd --daemon
  310 root         0 SW   [b_event]
  311 root         0 SW   [b_idle]
  317 root         0 SW<  [fp]
  339 root         0 SW<  [dmx0]
  345 root         0 SW<  [dmx1]
  354 root         0 SW<  [dmx2]
  355 root         0 SW<  [dmx_hw_sec]
  391 messageb  2408 S    /usr/bin/dbus-daemon --system
  394 root      1928 S    /usr/bin/wdog tpmd
  395 root      4312 S    tpmd
  398 root      1928 S    /usr/bin/wdog dccamd -
  399 root      3136 S    dccamd -
  408 avahi     3084 S    avahi-daemon: running [dm500hd.local]
  441 root      4076 S    nmbd -D
  443 root      6780 S    smbd -D
  458 root      6780 S    smbd -D
  465 root      2504 S    udhcpc -R -b -T3 -A10 -p /var/run/udhcpc.eth0.pid -i
  477 root      1712 S    /usr/sbin/zeroconf -i eth0
  493 root      2348 S    /usr/sbin/dropbear -r /etc/dropbear/dropbear_rsa_host
  496 root      1832 S    /usr/sbin/inetd
  499 root      2504 S    /sbin/syslogd -n -O /var/log/messages -s 32 -b 1 -m 2
  501 root      2504 S    /sbin/klogd -n
  614 root      2256 S    /usr/sbin/automount --pid-file=/var/run/autofs/_autof
  675 root      2504 S    /bin/sh /usr/bin/enigma2.sh
  678 root     65104 S    /usr/bin/enigma2
  687 root     65104 S    /usr/bin/enigma2
  709 root     65104 S    /usr/bin/enigma2
  717 root     65104 S N  /usr/bin/enigma2
22611 root      2824 S    telnetd
22612 root      2820 S    -sh
22737 root      2820 R    ps
root@dm500hd:~#

Update: I obviously already have the /media folder.

root@dm500hd:/# cd /media
root@dm500hd:/media# cd /share
root@dm500hd:/usr/share#

When I try to cd to /share it redirects to /usr/share. So can I use this folder instead of creating a new one?…

Update: I have made a new attempt at it now…

root@dm500hd:/# sudo mkdir /newfolder/share
-sh: sudo: not found
root@dm500hd:/# $ sudo mkdir /newfolder/share
-sh: $: not found
root@dm500hd:/# $sudo mkdir /newfolder/share
mkdir: cannot create directory '/newfolder/share': No such file or directory
root@dm500hd:/# $sudo mkdir /media/share
root@dm500hd:/# $sudo chmod a+r /media/share
root@dm500hd:/# $sudo mount -a
mount: mounting /dev/sda1 on /media/hdd failed: No such file or directory
root@dm500hd:/# edit /etc/fstab
-sh: edit: not found
root@dm500hd:/# edit /etc/fstab
-sh: edit: not found
root@dm500hd:/# open /etc/fstab
-sh: open: not found
root@dm500hd:/#

So I needed to add the dollar sign? And no spaces in-between? It looks like it worked this time… I first tried creating a folder named newfolder. Why did it refuse? I then created the /media/share folder… how did this affect the existing share symlink (or whatever that was) that was there previously?

Is sh the Bourne or Thompson shell? Or are all Linux shells abbreviated as sh and even Ash shell?

How do you edit a file in shell? I had to download fstab and edit it on Windows and then send it back over FTP.

Then I tried the $sudo mount -a and it gave me this:

root@dm500hd:/# $sudo mount -a
mount: mounting /dev/sda1 on /media/hdd failed: No such file or directory
mount: mounting //192.168.0.107/recordings on /media/share failed: No such device
root@dm500hd:/#

This is the content of my fstab file:

rootfs               /                    auto       defaults              1 1
proc                 /proc                proc       defaults              0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
usbfs                /proc/bus/usb        usbfs      defaults              0 0
/dev/mtdblock2       /boot                jffs2      ro                    0 0
tmpfs                /var                 tmpfs      defaults              0 0
tmpfs                /tmp                 tmpfs      defaults              0 0
/dev/sda1            /media/hdd           auto       defaults              0 0
//192.168.0.107/recordings /media/share smbfs auto,user=classified,password=classfied 0 0

I will try to reboot the box and see if it works.

Update: Still no luck…

It still gives me mount: mounting //192.168.0.107/recordings on /media/share failed: No such device. I tried replacing the IP with the computer name but it gives me the same message.

I even tried reversing the order of the terms in fstab (in case it's a syntax thing) so that I get /media/share first on the line. It gave me mount: mounting /media/share on /computername/recordings failed: No such file or directory.

Update: I got lucky…

Why do you insist on mounting to /media/share? Is it a convention thing? Can I mount to another folder? I solved the problem by creating a new folder and a new share in Windows and then using mount -t cifs command.

OpenDreambox 1.6.0 dm500hd


dm500hd login: root
root@dm500hd:~# $sudo mount -a
mount: mounting /dev/sda1 on /media/hdd failed: No such file or directory
mount: mounting //192.168.0.107/recordings on /media/share failed: No such device

I think the /dev/sda1 on /media/hdd failed part is because there is no disk drive connected. This STB has the ability to connect a HDD on the eSATA port but there is none connected.

I think that second line shows because the IP is wrong. I think it should have been 192.168.0.101 while 192.168.0.107 was the name of the STB box that I'm trying to mount to.

root@dm500hd:~# ps
  PID USER       VSZ STAT COMMAND
    1 root      1724 S    init [3]
    2 root         0 SW   [migration/0]
    3 root         0 SWN  [ksoftirqd/0]
    4 root         0 SW   [migration/1]
    5 root         0 SWN  [ksoftirqd/1]
    6 root         0 SW<  [events/0]
    7 root         0 SW<  [events/1]
    8 root         0 SW<  [khelper]
    9 root         0 SW<  [kthread]
   10 root         0 SW<  [kblockd/0]
   11 root         0 SW<  [kblockd/1]
   12 root         0 SW<  [khubd]
   13 root         0 SW   [pdflush]
   14 root         0 SW   [pdflush]
   15 root         0 SW<  [kswapd0]
   16 root         0 SW<  [aio/0]
   17 root         0 SW<  [aio/1]
   18 root         0 SW<  [ata/0]
   19 root         0 SW<  [ata/1]
   20 root         0 SW<  [ata_aux]
   21 root         0 SW<  [scsi_eh_0]
   22 root         0 SW<  [scsi_eh_1]
   23 root         0 SW   [mtdblockd]
   24 root         0 SWN  [jffs2_gcd_mtd3]
   70 root      2180 S <  udevd --daemon
  313 root         0 SW   [b_event]
  314 root         0 SW   [b_idle]
  320 root         0 SW<  [fp]
  344 root         0 SW<  [dmx0]
  351 root         0 SW<  [dmx1]
  359 root         0 SW<  [dmx2]
  360 root         0 SW<  [dmx_hw_sec]
  396 messageb  2408 S    /usr/bin/dbus-daemon --system
  399 root      1928 S    /usr/bin/wdog tpmd
  400 root      4312 S    tpmd
  403 root      1928 S    /usr/bin/wdog dccamd -
  404 root      3136 S    dccamd -
  413 avahi     3084 S    avahi-daemon: running [dm500hd.local]
  451 root      4076 S    nmbd -D
  453 root      6780 S    smbd -D
  473 root      6780 S    smbd -D
  489 root      2504 S    udhcpc -R -b -T3 -A10 -p /var/run/udhcpc.eth0.pid -i
  503 root      1712 S    /usr/sbin/zeroconf -i eth0
  519 root      2348 S    /usr/sbin/dropbear -r /etc/dropbear/dropbear_rsa_host
  522 root      1832 S    /usr/sbin/inetd
  525 root      2504 S    /sbin/syslogd -n -O /var/log/messages -s 32 -b 1 -m 2
  527 root      2504 S    /sbin/klogd -n
  640 root      2256 S    /usr/sbin/automount --pid-file=/var/run/autofs/_autof
  701 root      2504 S    /bin/sh /usr/bin/enigma2.sh
  704 root     84536 S    /usr/bin/enigma2
  713 root     84536 S    /usr/bin/enigma2
  735 root     84536 S    /usr/bin/enigma2
  748 root     84536 S N  /usr/bin/enigma2
  739 root         0 SW<  [kdvb-ad-0-fe-0]
  886 root      7324 S    smbd -D
  965 root      2824 S    telnetd
  966 root      2820 S    -sh
 1063 nobody    2292 S    vsftpd
 1065 root      2316 S    vsftpd
 1076 root      2820 R    ps
root@dm500hd:~# smbd
root@dm500hd:~# $sudo mount -a
mount: mounting /dev/sda1 on /media/hdd failed: No such file or directory
mount: mounting /computername/recordings on /media/share failed: No such device

On this last line I was trying to use the network name of the computer instead of the IP address in the fstab file. But that didn't help… maybe it has to be an IP, and not a network name?… don't know…

root@dm500hd:~# $sudo mount -a
mount: mounting /dev/sda1 on /media/hdd failed: No such file or directory
mount: mounting /media/share on /computername/recordings failed: No such file or directory
root@dm500hd:~# $sudo mount -a
mount: mounting /dev/sda1 on /media/hdd failed: No such file or directory
mount: mounting //media/share on /computername/recordings failed: No such file or directory
root@dm500hd:~# $sudo mount -a
mount: mounting /dev/sda1 on /media/hdd failed: No such file or directory
mount: mounting //media/share on /computername/recordings failed: No such file or directory
root@dm500hd:~# $sudo mount -a
mount: mounting /dev/sda1 on /media/hdd failed: No such file or directory
mount: mounting //computername/recordings on /media/share failed: No such device

I tried editing and updating the fstab file in different ways, like adding extra spaces… I thought in case it's a formatting thing…

This is the part that gave me the working solution:

I created a folder named dreambox under C drive on the Windows machine and shared it with the Everyone groupe. Then I did the commands below.

root@dm500hd:~# cd /
root@dm500hd:/# mkdir
BusyBox v1.15.3 (2010-10-14 16:48:44 UTC) multi-call binary

Usage: mkdir [OPTIONS] DIRECTORY...

Create DIRECTORY

Options:
        -m      Set permission mode (as in chmod), not rwxrwxrwx - umask
        -p      No error if existing, make parent directories as needed

root@dm500hd:/# /hdd/movie
-sh: /hdd/movie: not found
root@dm500hd:/# mkdir /hdd/movie

The /hdd is a syslink (symbolic link) I think so it is really located at `/media/hdd`. Note that this is the same location where `/dev/sda1` is mounted.

root@dm500hd:/# mount -t cifs -o username=user,password=pass //192.168.0.10
7/dreambox /hdd
mount: mounting //192.168.0.107/dreambox on /hdd failed: No such device or address
root@dm500hd:/# mount cifs user=user,password=pass //192.168.0.101/dreambox /hdd

The 192.168.0.107 is the IP of the STB box so this is wrong. The correct one fo the share hosting Windows machine is 192.168.0.101. Also, it is "username" and not user".

This is the output:

BusyBox v1.15.3 (2010-10-14 16:48:44 UTC) multi-call binary

Usage: mount [flags] DEVICE NODE [-o OPT,OPT]

Mount a filesystem. Filesystem autodetection requires /proc be mounted.

Options:
        -a              Mount all filesystems in fstab
        -r              Read-only mount
        -w              Read-write mount (default)
        -t FSTYPE       Filesystem type
        -O OPT          Mount only filesystems with option OPT (-a only)
-o OPT:
        loop            Ignored (loop devices are autodetected)
        [a]sync         Writes are [a]synchronous
        [no]atime       Disable/enable updates to inode access times
        [no]diratime    Disable/enable atime updates to directories
        [no]relatime    Disable/enable atime updates relative to modification time
        [no]dev         (Dis)allow use of special device files
        [no]exec        (Dis)allow use of executable files
        [no]suid        (Dis)allow set-user-id-root programs
        [r]shared       Convert [recursively] to a shared subtree
        [r]slave        Convert [recursively] to a slave subtree
        [r]private      Convert [recursively] to a private subtree
        [un]bindable    Make mount point [un]able to be bind mounted
        bind            Bind a directory to an additional location
        move            Relocate an existing mount point
        remount         Remount a mounted filesystem, changing its flags
        ro/rw           Read-only/read-write mount

There are EVEN MORE flags that are specific to each filesystem
You'll have to see the written documentation for those filesystems

As you can see this was a wrong syntax. One must use one of the options.

root@dm500hd:/# mount -t cifs -o username=user,password=pass //192.168.0.10
1/dreambox /hdd
root@dm500hd:/# mount -a
mount: mounting //computername/recordings on /media/share failed: No such device

This last line is because I still had that line added to the fstab file. After editing the fstab file and removing this line I had added earlier this mount -t cifs command took effect.

root@dm500hd:/# mount -a
root@dm500hd:/# $sudo mount -a
root@dm500hd:/#

Note that there is no error output when I do mount -a or sudo mount -a.

I followed this guide: http://www.maxteknik.se/forum/viewtopic.php?t=3828

Best Answer

The easiest way of doing this is using the SMB protocol. On your Linux machine, create the mountpoint for the sharedfolder:

$ sudo mkdir /media/share
$ sudo chmod a+xr /media/share

The second command sets the `/media/share/directory to be readable and executable (meaning users can change into that directory) by all users.

On *ix systems, settings for mounting drives (local or remote) are set in the etc/fstab file. The general format of the file is:

DRIVE  LOCAL_MOUNT_DIRECTORY FILESYSTEM OPTIONS    


Edit /etc/fstab on your linux box and add this line:

//x.x.x.x/recordings /media/share smbfs auto,user=USER,password=PASS 0 0

Change x.x.x.x./YouShareName to show your windows server's IP and set USER and PASS correctly. If everything goes well it should work and will be mounted when the (linux) system reboots. To test without rebooting run:

$ sudo mount -a

For more information and a more detailed howto, see here.

Related Question