motioneye-project / motioneye

A web frontend for the motion daemon.
GNU General Public License v3.0
3.97k stars 651 forks source link

Use SMB for saving files o #1492

Open nishant2019 opened 5 years ago

nishant2019 commented 5 years ago

MotioneyeOS has a option to share captured images or videos to SMB share but I cannot find the same option in motioneye installed on raspbian OS. Can anyone assist me how a can use SMB option ?

reparator commented 5 years ago

You must install samba on raspbian:

pi@PiServer:~ $ sudo apt-get update
pi@PiServer:~ $ sudo apt-get upgrade
pi@PiServer:~ $ sudo apt-get install samba samba-common-bin
pi@PiServer:~ $ cd /media
pi@PiServer:/media $ sudo mkdir exchange

exchange is a folder mounted as smb-share later. (You can change the name and location if you want). Now change the owner of the exchange folder: pi@PiServer:/media $ sudo chown -R pi:pi /media/exchange/ and add the user pi to the smb-users:

pi@PiServer:/media $ sudo smbpasswd -a pi
New SMB password:
Retype new SMB password:
Added user pi.

Now configure samba:

pi@PiServer:/media $ cd /etc/samba
pi@PiServer:/etc/samba $ sudo nano smb.conf

Change the workgroup entry in global section to your Workgroup-Name. Add the following at the end of the File:

[RaspberryPi]
comment = Raspberry Pi Exchange
path = /media/exchange
writeable = yes
guest ok = no

Save with CTRL o and leave the editor with CTRL x. After that restart samba:

pi@PiServer:/etc/samba $ sudo /etc/init.d/samba restart
[ ok ] Restarting nmbd (via systemctl): nmbd.service.
[ ok ] Restarting smbd (via systemctl): smbd.service.
pi@PiServer:/etc/samba $

In Motioneye now you can add the path to store the files under File Storage, Root directory. The files in this folder are now accessible from your network.

If you want to store the files on a permanent mounted network device (e.g. a NAS), you have to add this device to the raspbian system. To achive that do the following:

pi@PiServer:~$ sudo apt-get update
pi@PiServer:~$ sudo apt-install cif-utils
pi@PiServer:~$ sudo mkdir /media/MyNAS-Folder

where MyNAS-Folder is the name of the folder, your NAS will be mounted later. Choose your preferred name. Mount the folder now to your NAS: sudo mount -t cifs -o username=USER,password=PASSWORD,vers=1.0 //<Your IP-Adress>/SMB-Network-Folder //media/MyNAS-Folder

Your-IP-Adress is the adress of your NAS, SMB-Network-Folder is the Folder on the NAS which is served to the network. Now the NAS is mounted to the Raspi-System and is accessible as storage devive for motioneye. If you want that permantely (after reboot it should be mounted again), do the following: Generate a file with name .smbcredentials in your home directory:

pi@PiServer:~$ touch .smbcredentials
pi@PiServer:~$ nano .smbcredentials

with the content:

user=<your username on NAS>
password=<your password on the NAS>

Save with ctrl o und leave with ctrl x. Now edit the file system table. Careful! first make a copy of it, as wrong settings may crash the system:

pi@PiServer:~$ sudo cp /etc/fstab /etc/fstab.original
pi@PiServer:~$ sudo nano /etc/fstab

Add the following line at the end of the file: //<IP-Adress of the Network-NAS>/<SMB-Network-Folder> /media/MyNAS-Folder cifs credentials=/home/pi/.smbcredentials,uid=1000,gid=1000,vers=1.0 0 0 Take care that there are no spaces between the options (after credentials) but two spaces between the entrys. The option vers=1.0 can be skipped if your NAS speaks a higher version level of samba. The entry credentials must fit your credentials-file in home directory. After reboot the NAS-folder should be mounted permantly. You can use it as a normal storage path i motioneye (/media/MyNAS-Folder). Hope this helps ... Regards Stefan

Bromley47 commented 4 years ago

I have used the above instructions to save my Motioneye media on a WDMycloud NAS drive, due to limited storage on the SD card, plus the fact that I am using as a security camera and the camera could easily get pinched (along with the SD card and the saved images!) if someone realises what it is.

Had to re-figure some of the instructions (Googled them if they didn't work as should) and it saves the images to the MyCloud BUT only for while - at some stage it reverts back to saving them on the SD card, especially after a restart of the Pi. Any clues anyone - would be appreciated. To get it back to saving on the MyCloud drive I have to copy all the above again onto the Pi. I imagine I don't have to install all the above but not sure where to dive in and reinstall.

J-o-h-n-M commented 3 years ago

Is this configuration still required? There is a GUI option "Enable Samba Server". But I cant get that to work. As the post here is from 2019, I was under the impression that it is now included in the GUI and no longer requires the separate installation of Samba.

starbasessd commented 3 years ago

In motion/motionEye on another OS, you must still install SAMBA server as part of that OS. In motionEyeOS it is built in.

On Tue, Apr 20, 2021 at 7:38 AM John @.***> wrote:

Is this configuration still required? There is a GUI option "Enable Samba Server". But I cant get that to work. As the post here is from 2019, I was under the impression that it is now included in the GUI and no longer requires the separate installation of Samba.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ccrisan/motioneye/issues/1492#issuecomment-823203399, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZTUHKS3HWCYJGH6OH6A7DTJVRRZANCNFSM4JADFVOA .

-- Thanks

Kevin Shumaker

Personal Tech Support https://kevinshumaker.wixsite.com/thethirdlevel

N38° 19' 56.52" W85° 45' 8.56"

Semper Gumby “Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA Ethics are what we do when no one else is looking. Quis custodiet ipsos custodes? “There is no end to the good you can do if you don’t care who gets the credit.” - C Powell You know we're sitting on four million pounds of fuel, one nuclear weapon and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it?

J-o-h-n-M commented 3 years ago

@starbasessd thanks for the quick reply. I am running on RPI4 and see

motionEye Version | 0.42.1
Motion Version | 4.2.2+gitUNKNOWN
OS Version | motionEyeOS 20200606

So I would not need to configure anything seperate?

starbasessd commented 3 years ago

Correct. You may want to head over to the motionEyeOS Github, too. More pertinent info available. https://github.com/ccrisan/motioneyeos/wiki

On Tue, Apr 20, 2021 at 7:50 AM John @.***> wrote:

@starbasessd https://github.com/starbasessd thanks for the quick reply. I am running on RPI4 and see

motionEye Version | 0.42.1 Motion Version | 4.2.2+gitUNKNOWN OS Version | motionEyeOS 20200606

So I would not need to configure anything seperate?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ccrisan/motioneye/issues/1492#issuecomment-823209946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZTUHIMUASWJGYBIOTVW4TTJVS7JANCNFSM4JADFVOA .

-- Thanks

Kevin Shumaker

Personal Tech Support https://kevinshumaker.wixsite.com/thethirdlevel

N38° 19' 56.52" W85° 45' 8.56"

Semper Gumby “Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA Ethics are what we do when no one else is looking. Quis custodiet ipsos custodes? “There is no end to the good you can do if you don’t care who gets the credit.” - C Powell You know we're sitting on four million pounds of fuel, one nuclear weapon and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it?

starbasessd commented 3 years ago

Also, with a Pi4, the dev20201026 is much more stable.

On Tue, Apr 20, 2021 at 7:53 AM Kevin Shumaker @.***> wrote:

Correct. You may want to head over to the motionEyeOS Github, too. More pertinent info available. https://github.com/ccrisan/motioneyeos/wiki

On Tue, Apr 20, 2021 at 7:50 AM John @.***> wrote:

@starbasessd https://github.com/starbasessd thanks for the quick reply. I am running on RPI4 and see

motionEye Version | 0.42.1 Motion Version | 4.2.2+gitUNKNOWN OS Version | motionEyeOS 20200606

So I would not need to configure anything seperate?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ccrisan/motioneye/issues/1492#issuecomment-823209946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZTUHIMUASWJGYBIOTVW4TTJVS7JANCNFSM4JADFVOA .

-- Thanks

Kevin Shumaker

Personal Tech Support https://kevinshumaker.wixsite.com/thethirdlevel

N38° 19' 56.52" W85° 45' 8.56"

Semper Gumby “Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA Ethics are what we do when no one else is looking. Quis custodiet ipsos custodes? “There is no end to the good you can do if you don’t care who gets the credit.” - C Powell You know we're sitting on four million pounds of fuel, one nuclear weapon and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it?

-- Thanks

Kevin Shumaker

Personal Tech Support https://kevinshumaker.wixsite.com/thethirdlevel

N38° 19' 56.52" W85° 45' 8.56"

Semper Gumby “Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA Ethics are what we do when no one else is looking. Quis custodiet ipsos custodes? “There is no end to the good you can do if you don’t care who gets the credit.” - C Powell You know we're sitting on four million pounds of fuel, one nuclear weapon and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it?

J-o-h-n-M commented 3 years ago

Thanks! will have a look and also upgrade to 20201026. Really appreciate the quick reply!