Jump to content

Recommended Posts

Posted

Hello guys,

 

I have an BananaPi M1 board runing armbian 5.31, already installed apache and mysql months ago, also an sata drive and the box is running smooth, I have alot of sensors around the house that are pushing new values to my mysql database, every minute, or every few minutes,  but now I want to setup my cameras to use the FTP to store images in a folder accessible by apache, when cameras detect motion, can you point me in the right direction to install a FTP server

 

I want to be able to see all the images saved by the cameras, in my dashboard, a website I made and host in this BananaPi box.

 

 

dashboard_.jpg

Posted

If you have SSH enabled you have sFTP installed and ready to use. Check if yo can reach ftp://your-server:22 (don't forget to add the 22 port at the end because is dfferent form normal FTP port, the 21).

Posted

Yes, SSH is enabled as the bananaPi runs headless, I tried to set the security camera to connect to that ftp but it doesn't work, probably because it's SFTP and the camera can connect only to simple FTP servers, also Windows Explorer couldn't connect to that.

 

Any more advices ?

 

Thank you.

Posted

OK, following commands was never tested on my armbian boards but I used long time ago on Raspberry Pi with Raspbian:

sudo apt-get install vsftpd

Edit and config the server:

sudo nano /etc/vsftpd.conf

Uncomment this lines:

local_enable=YES
write_enable=YES

Save the changes and restart the server:

sudo service vsftpd restart

Now you maybe can connect to the insecure ftp server using:

the IP of your armbian machine

the user and password you configure in the first run.

 

Here you can found more info about vsftpdhttps://itsfoss.com/set-ftp-server-linux/

 

Posted

Thanks for your advices, it was quite easy to setup the ftp using your instructions, I also created a new user and setup the user home directory inside /var/www/html/security_camera_storage.  The camera is saving new images each time there is motion, my only problem so far is how other users can access those images? 

 

I tried to create a php script to scan the directory where images are saved but it seems it fails as the directory is owned by user securitycam, and php is running with a different user. I want to setup some cronjobs to scan and delete old files (let's say, I will delete every image older than 3 days), I will also need to display the images in my dashboard, so I will definitely need to find a fix to this "issue"

 

The other files in html folder are owned by admin user.

 

Any advices on how to setup the ftp to save files that can be accessed by admin user, are welcome :)

 

Thank you.

 

UPDATE

 

I have added user admin to group secuirtycam, but still didn't help:

 

sudo usermod -a -G securitycam admin
sudo chgrp -R securitycam /var/www/html/security_camera_storage

 

After seeing that PHP still can't access that folder, I changed the permissions of that folder to 777. Is this such a bad thing? even if this bananaPi is a local device, obody else has access to this pi, just me.

 

sudo chmod -R 777 /var/www/html/security_camera_storage

 

This way it scans the folder, but unfortunately newly added files, are still not accessible, the main folder is accessible, PHP script is seeing all the files, even the new ones, but when I try to display them in a webpage, the images are not shown. So I still need to fix this, the proper way :)

 

Thank you.

 

permissions2.jpg

permissions1.jpg

no access to newsly created files.jpg

Posted

Is the image stored in a partition formatted in fat32, ntfs or some type different than linux (ext4 or similar)?

Because I normally have problems with permissions when I mess with this kind of Windows things.

Posted

No, the images are saved to the HDD attached to BananaPi through the SATA interface. Is a linux standard partiton

 

root@banana:/dev/disk/by-id# sudo file -s /dev/sd*
/dev/sda:  DOS/MBR boot sector MS-MBR 9M english at offset 0x10+0xFF "Invalid partition table" at offset 0x127 "Error loading operating system" at offset 0x146 "Missing operating system", disk signature 0x44fdfe06, created with driveID 0x81 at 15:37:29; partition 1 : ID=0x83, start-CHS (0x0,1,1), end-CHS (0x3ff,254,63), startsector 63, 20980827 sectors; partition 2 : ID=0x5, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 20980890, 1932539175 sectors
/dev/sda1: Linux rev 1.0 ext3 filesystem data, UUID=354516e5-69a7-4c4f-affb-e0b8c9237cb4 (needs journal recovery) (large files)
/dev/sda2: DOS/MBR boot sector; partition 1 : ID=0x7, start-CHS (0x1,1,1), end-CHS (0x3ff,254,63), startsector 16128, 1932523047 sectors
/dev/sda5: Linux rev 1.0 ext4 filesystem data, UUID=967bcb76-8f1e-4827-85d4-86082ae2250e (needs journal recovery) (extents) (large files) (huge files)

Is there a problem, regarding the message for /sda ? (Invalid partition table)

 

Maybe I can setup vsftpd to save the files with permissions like 777, so this way I can access them using any user (php, ftp, samba) ?

 

 

UPDATE.

My solution is to add the next two lines in /etc/vsftpd.conf Now I can view in my dashboard all the images written by the security camera to bananaPi hdd, I will setup a new cronjob to delete old files, and only keep the most recent ones (3 days .. or maybe 7 days)

 

local_umask=0002
file_open_mode=0777

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines