yi-hack-Allwinner-v2 icon indicating copy to clipboard operation
yi-hack-Allwinner-v2 copied to clipboard

ftp upload not working

Open albertopalotes35 opened this issue 4 years ago • 56 comments

I have a problem with the ftp upload of the videos recorded by the camera, I have configured an ftp server in an asus router to which I have a pendrive connected, in the motion events settings, I have ftp upload enabled, in ftp host I have the router address 192.168.1.1, but it doesn't work, we don't upload the videos to the ftp server

albertopalotes35 avatar Feb 22 '21 17:02 albertopalotes35

Try to run the script ftppush.sh manually and check the logs.

roleoroleo avatar Feb 22 '21 18:02 roleoroleo

How I run the script, I don't know how to do it

albertopalotes35 avatar Feb 22 '21 18:02 albertopalotes35

Login with ssh and run the folling commands:

root@yi-hack-allwinner-v2:~# . /tmp/sd/yi-hack/script/env.sh
root@yi-hack-allwinner-v2:~# /tmp/sd/yi-hack/script/ftppush.sh start

roleoroleo avatar Feb 22 '21 19:02 roleoroleo

This is what I get when I run it manually by ssh, the time and date are not current because I don't have internet on the router where the camera is connected and I don't know how to manually set the date and time on the camera.

root@yi-96dd:~# . /tmp/sd/yi-hack/script/env.sh root@yi-96dd:~# /tmp/sd/yi-hack/script/ftppush.sh start 2020-04-17 [22-29-25] [INFO] === SERVICE START === 2020-04-17 [22-29-25] [INFO] checkFiles ftpput: unexpected server response to STOR: 550 Permission denied (restricted operation). 2020-04-17 [22-29-26] [ERROR] uploadToFtp: ftpput FAILED. 2020-04-17 [22-29-26] [ERROR] checkFiles: uploadToFtp FAILED - [/tmp/sd/record/2020Y04M17D22H/16M35S25.mp4]. ftpput: unexpected server response to STOR: 550 Permission denied (restricted operation). 2020-04-17 [22-29-26] [ERROR] uploadToFtp: ftpput FAILED. 2020-04-17 [22-29-26] [ERROR] checkFiles: uploadToFtp FAILED - [/tmp/sd/record/2020Y04M17D22H/17M00S60.mp4]. ftpput: unexpected server response to STOR: 550 Permission denied (restricted operation).

albertopalotes35 avatar Feb 22 '21 19:02 albertopalotes35

Line 5 says that the user does not have correct permissions.

roleoroleo avatar Feb 22 '21 19:02 roleoroleo

The ftp server user is admin, in the asus router's ftp server configuration I have created a video folder which has R / W permissions activated for the admin user and in the motion events configuration, in ftp directory I have selected the video folder that I have created on the ftp server

albertopalotes35 avatar Feb 22 '21 20:02 albertopalotes35

Try to login manually (eg Filezilla) to the ftp and try to upload a file.

roleoroleo avatar Feb 22 '21 22:02 roleoroleo

It already works for me, the problem was that the path of the videos folder of the ftp server was incorrectly configured in the camera configuration, the path that I had set was / Videos and the correct path is / sda1 / Videos

Thank you very much.

albertopalotes35 avatar Feb 23 '21 10:02 albertopalotes35

Same here. Anon user gets cant' t change directory to /home/ftp and normal user seems not providing the correct password to the server.

ftpput: unexpected server response to PASS: 530 Login authentication failed

What can I do?

mik999 avatar Apr 20 '21 14:04 mik999

I get the same here too but my error is:

ftpput: unexpected server response to STOR: 553 12M00S60.mp4: Permission denied.

I have tested the ftpuser in the FTP server with WinSCP and FileZilla and the user / pass works and can create directories/files.

I have disabled unwanted services like ONVIF and Telnet and tried to enable the swap option., Nothing works.

Any tips please?

laneyweb avatar Apr 28 '21 23:04 laneyweb

Run it manually and post the full log: https://github.com/roleoroleo/yi-hack-Allwinner-v2/issues/101#issuecomment-783599076

roleoroleo avatar Apr 29 '21 06:04 roleoroleo

In my case I'm an idiot)) I used camera's IP as ftp server address. Damn stupid)) Now it all works like a charm. Cam sends vids to a folder on the ftp server. That folder is synced to OneDrive and set as online only. So the vids don't take up any space on the ftp server and always available online.

Thanks Roleo!

mik999 avatar Apr 29 '21 07:04 mik999

Thanks so much for the replies. I have captured the output showing the error after running the ftppush start. It's here in pastebin. Is this what you meant or is there a log file I need to grab too?

laneyweb avatar Apr 29 '21 07:04 laneyweb

In my case I'm an idiot)) I used camera's IP as ftp server address. Damn stupid)) Now it all works like a charm. Cam sends vids to a folder on the ftp server. That folder is synced to OneDrive and set as online only. So the vids don't take up any space on the ftp server and always available online.

Thanks Roleo!

I'm certainly one of those :) - I have checked the IP, user/pass many times.... so hope that's not it. Do you use a port number in the FTP Host field? I am leaving mine as just IP as the FTP sever is on default port 21.

I wonder if it can be the FTP server. I may spin up a test FTP server in a docker but I'd need to use another port... @roleoroleo does the FTP Host field support IP:PORT?

laneyweb avatar Apr 29 '21 08:04 laneyweb

Sorry to spam the posts. I have used an admin account (instead of my ftpuser account) and it all works. I must have a permission error at my FTP Server end. Sorry for the messing around. Thank you Roleo for the great work.

laneyweb avatar Apr 29 '21 08:04 laneyweb

Last post, I promise! :) Is it possible that there is a limit on the password length? I had used a password of 14 characters, no extended. Now I have a 6 char password, the ftpuser works fine. Just posted in case it helps others.

laneyweb avatar Apr 29 '21 09:04 laneyweb

I will check it.

roleoroleo avatar Apr 29 '21 10:04 roleoroleo

I think the problem is, that the created directory has only chmod 644.

If i chance the permissions to 755 at the ftp server, the uploads runs perfectly.

Maybe there is a error in the scripts, which do the upload?

soundylinz avatar Jul 21 '21 23:07 soundylinz

The script doesn't set permission. Simply it runs the mkd command to create the directory. It depends on the user permissions or on the ftp server configuration, if the new directory is 644 or 755. But you could try to change line 167

echo -e "USER ${FTP_USERNAME}\r\nPASS ${FTP_PASSWORD}\r\nmkd ${FTP_DIR}\r\nquit\r\n" | nc -w 5 ${FTP_HOST} 21 | grep "${FTP_DIR}"

with this

echo -e "USER ${FTP_USERNAME}\r\nPASS ${FTP_PASSWORD}\r\nmkd ${FTP_DIR}\r\nsite chmod 755 ${FTP_DIR}\r\nquit\r\n" | nc -w 5 ${FTP_HOST} 21 | grep "${FTP_DIR}"

and 174

echo -e "USER ${FTP_USERNAME}\r\nPASS ${FTP_PASSWORD}\r\nmkd ${FTP_DIR}/${FTP_DIR_HOUR}\r\nquit\r\n" | nc -w 5 ${FTP_HOST} 21 | grep "${FTP_DIR_HOUR}"

with this

echo -e "USER ${FTP_USERNAME}\r\nPASS ${FTP_PASSWORD}\r\nmkd ${FTP_DIR}/${FTP_DIR_HOUR}\r\nsite chmod 755 ${FTP_DIR}\r\nquit\r\n" | nc -w 5 ${FTP_HOST} 21 | grep "${FTP_DIR_HOUR}"

roleoroleo avatar Jul 22 '21 07:07 roleoroleo

Sorry ...

That doesn't change anything:

Screenshot 2021-07-22 164224

And: when you restart the cam, the folder with the date 2020 (etc.) is always created. Is that normal?

soundylinz avatar Jul 22 '21 14:07 soundylinz

Check if the user you are using is able to change permissions.

roleoroleo avatar Jul 23 '21 12:07 roleoroleo

This is the FTP from my web hosting provider, I don't have access to SSH here.

With the same access data, I can use everything in my FTP software, including CHMOD, etc.

soundylinz avatar Jul 23 '21 23:07 soundylinz

Could you try to run this command manually?

  • log in to you ftp server with a command line client.
  • run "mkd" to create a new directory
  • check the permissions
  • run "site chmod" to change the permissions
  • check again the permissions

roleoroleo avatar Aug 04 '21 14:08 roleoroleo

I have a problem with the ftp upload in the new camera, the camera is yi home ifus version the Firmware: 9.0.36.02 and I use the y211ga files version: 0.1.8, the upload to the ftp server does not work and if I run the command: / tmp / sd / yi-hack / script /ftppush.sh start by ssh I get this in the registry:

root@porche:~# /tmp/sd/yi-hack/script/ftppush.sh start 2021-08-04 [19-19-45] [INFO] === SERVICE START === 2021-08-04 [19-19-45] [INFO] checkFiles 2021-08-04 [19-20-30] [INFO] checkFiles 2021-08-04 [19-21-15] [INFO] checkFiles ash: 080421E2: bad number 2021-08-04 [19-21-15] [INFO] checkFiles: ignore file [/tmp/sd/record/2021Y08M04D21H/E220M00S60.mp4] - already sent. 2021-08-04 [19-22-00] [INFO] checkFiles ash: 080421E2: bad number 2021-08-04 [19-22-00] [INFO] checkFiles: ignore file [/tmp/sd/record/2021Y08M04D21H/E220M00S60.mp4] - already sent. ash: 080421E2: bad number 2021-08-04 [19-22-00] [INFO] checkFiles: ignore file [/tmp/sd/record/2021Y08M04D21H/E221M00S60.mp4] - already sent. 2021-08-04 [19-22-46] [INFO] checkFiles ash: 080421E2: bad number

If I go into the motion event section, the folder of what he has recorded appears, but no file of what he has recorded appears, however if I connect by ftp to the camera if the recorded files appear. you can see it in the following images: https://drive.google.com/file/d/19Geg0jOIoL_93v00QSzTr1TTJI6ei3F7/view?usp=sharing https://drive.google.com/file/d/1mavQ6scVDpLs1foJUuoVKucunEw0xAir/view?usp=sharing https://drive.google.com/file/d/1bATWcqh63VTzi89SxCu_Yc8T9-yLT53k/view?usp=sharing

I need to use the ftp upload function for my video surveillance system.

albertopalotes35 avatar Aug 04 '21 19:08 albertopalotes35

Sorry, to many Problems...

I've returned the camera.

soundylinz avatar Aug 04 '21 20:08 soundylinz

I have a problem with the ftp upload in the new camera, the camera is yi home ifus version the Firmware: 9.0.36.02 and I use the y211ga files version: 0.1.8, the upload to the ftp server does not work and if I run the command: / tmp / sd / yi-hack / script /ftppush.sh start by ssh I get this in the registry:

root@porche:~# /tmp/sd/yi-hack/script/ftppush.sh start 2021-08-04 [19-19-45] [INFO] === SERVICE START === 2021-08-04 [19-19-45] [INFO] checkFiles 2021-08-04 [19-20-30] [INFO] checkFiles 2021-08-04 [19-21-15] [INFO] checkFiles ash: 080421E2: bad number 2021-08-04 [19-21-15] [INFO] checkFiles: ignore file [/tmp/sd/record/2021Y08M04D21H/E220M00S60.mp4] - already sent. 2021-08-04 [19-22-00] [INFO] checkFiles ash: 080421E2: bad number 2021-08-04 [19-22-00] [INFO] checkFiles: ignore file [/tmp/sd/record/2021Y08M04D21H/E220M00S60.mp4] - already sent. ash: 080421E2: bad number 2021-08-04 [19-22-00] [INFO] checkFiles: ignore file [/tmp/sd/record/2021Y08M04D21H/E221M00S60.mp4] - already sent. 2021-08-04 [19-22-46] [INFO] checkFiles ash: 080421E2: bad number

If I go into the motion event section, the folder of what he has recorded appears, but no file of what he has recorded appears, however if I connect by ftp to the camera if the recorded files appear. you can see it in the following images: https://drive.google.com/file/d/19Geg0jOIoL_93v00QSzTr1TTJI6ei3F7/view?usp=sharing https://drive.google.com/file/d/1mavQ6scVDpLs1foJUuoVKucunEw0xAir/view?usp=sharing https://drive.google.com/file/d/1bATWcqh63VTzi89SxCu_Yc8T9-yLT53k/view?usp=sharing

I need to use the ftp upload function for my video surveillance system.

Probably the script must be updated with the new naming convention.

roleoroleo avatar Aug 05 '21 13:08 roleoroleo

By when do you think you can have it corrected?

albertopalotes35 avatar Aug 05 '21 14:08 albertopalotes35

I need a few days.

roleoroleo avatar Aug 05 '21 15:08 roleoroleo

No problem, I'll wait patiently.

albertopalotes35 avatar Aug 05 '21 15:08 albertopalotes35

Try this commit: https://github.com/roleoroleo/yi-hack-Allwinner-v2/commit/6e084f08227871573c05f067f0ee45f23507d2f8

roleoroleo avatar Aug 10 '21 16:08 roleoroleo