ftp causing invalid syntax

Rob, do yourself (and others) a favour by getting yourself a copy of "Linux in a Nutshell" if you're familiar with another OS at command-line level, or a copy of "Linux for Dummies" if you don/t have that background.
Read enough of it to understand the filing system, command shell and common utilities.
BTW, suggesting "Linux for Dummies" is not an insult - the "... for Dummies" books are well-regarded as books for beginners in computer- related subjects.
--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie
Loading thread data ...
I have changed 777 to 775.
The reason I used it was because I didn't want any problems with no permissions either writing the file to my NAS box and viewing the file as a user
chown -R pi /mnt/CCTV returns this:
chown: changing ownership of '/mnt/CCTV/PiZero/dht.cpp': Operation not permitted chown: changing ownership of '/mnt/CCTV/PiZero/2018-06-14_10.12.34.h264': Operation not permitted chown: changing ownership of '/mnt/CCTV/PiZero/2018-050-23_17.m%.19.h264': Operation not permitted
I used sudo chmod without any errors.
Using this eample, does the group have to be named, as in g= name of group??
chmod -R +w,g=rw,o-rw, ~/group-project-files/
I'l have to buy a book on this subject before I can go any further with it. I did hope that google would give the answer, but yet.
Thanks
Reply to
RobH
I did change to chmod with those same params, but /mnt permission is still only root.
Reply to
RobH
Thanks and no problem with the Linux for Dummies , as it does seem I need some written material.
Out of interest, I have only being using linux f.or just under a year now, and never need any books as I just used it
Reply to
RobH
On Thu, 14 Jun 2018 15:59:29 +0100, RobH declaimed the following:
If you had used "chmod" without "sudo" you'd have had the same error
All "sudo" prefix does is say "execute the following command using "root" privileges... I presumed you'd realize that changing ownership would require those elevated privileges and would use the sudo prefix; I merely suggested the proper syntax for the "chown" part.
Look at the output of "ls -l", it will tell you the owner, and the group, that a file belongs to. If the user is a member of the group, it will have the group privileges.
What the above command did is: add write (modify) privilege -- likely for the owner (who already had it), set group member access to read/write, and change "other" access to remove read/write (no access at all unless the files had eXecute privilege for "other".
Even before you get a book on Linux basics, try to learn how to read the result of
man command-of-interest
(though you may have to install the man pages; I don't recall if RPi installs those by default)
--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber
Ok, I'll have a look at that.
Anyways, this is what I have tried so far
pi@raspberrypi:~ $ chown -R pi /mnt pi@raspberrypi:~ $ chown -R pi /mnt/CCTV pi@raspberrypi:~ $ chown -R pi /mnt/CCTV/PiZero
pi@raspberrypi:~ $ cd Downloads pi@raspberrypi:~/Downloads $ python intruder.py Traceback (most recent call last): File "intruder.py", line 37, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 13] Permission denied: '/mnt/CCTV/PiZero/2018-06-14_17.35.31.h264'
pi@raspberrypi:~ $ chown -R pi:pi /mnt/CCTV/PiZero chown: changing ownership of '/mnt/CCTV/PiZero/2018-06-14_17.35.31.h264': Operation not permitted
pi@raspberrypi:~ $ sudo chmod -R pi=pi /mnt chmod: invalid mode: ?pi=pi? Try 'chmod --help' for more information.
I have been googling this permissions problem and have tried what you see from what others have said.
The main problem I have is no matter what I try or do, the permissions do not change for the /mnt directory. This is owner and group of root.
The other child folder permissons are owned by pi, and group pi, so unless I can get the permissions changed for /mnt, Ill never get my project finished.
Reply to
RobH
The 0 byte files are being produced by the python script and have been copied from the piZero over to my NAS box, and have 5 files from today's efforts
Reply to
RobH
I changed the owner and group of /mnt to pi:pi, then checked in Pi's gui file mangler, but /mnt was till owned by root.
Then tried:
pi@raspberrypi:/mnt $ ls -l total 4 drwxrwxrwx 3 pi pi 4096 Jun 5 09:50 CCTV
So I then tried:
pi@raspberrypi:~/Downloads $ python intruder.py Traceback (most recent call last): File "intruder.py", line 37, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 13] Permission denied: '/mnt/CCTV/PiZero/2018-06-14_19.52.39.h264'
Changing user and group made no difference
Looking in the pi's gui file mangler again shows that root is still the owner of /mnt All the child folders are owned by pi:pi (user:group)
Reply to
RobH
On Thu, 14 Jun 2018 20:04:35 +0100, RobH declaimed the following:
Try
ls -lR
and ensure that ALL directories, not just CCTV, have been changed.
The other side of the coin (recall, I do not have a NAS unit) is that the NAS may need to be configured with privileges for users.
Forget about running the capture script... You need to get everything working from the command line first...
Create some garbage file in your home directory
$ date >~/junk.txt
Then try moving that file to the mount point...
$ mv ~/junk.txt /mnt/CCTV/PiZero/junk.txt
That should represent what the script is trying to do.
--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber
After creating the junk.txt file and moving it: pi@raspberrypi:~ $ mv ~/junk.txt /mnt/CCTV/PiZero/junk.txt mv: preserving times for '/mnt/CCTV/PiZero/junk.txt': Operation not permitted mv: preserving permissions for ?/mnt/CCTV/PiZero/junk.txt?: Input/output error
The said file was moved to my NAS box on /mnt/CCTV/PiZero and shows as 29 bytes but could not be opened. Because it is owned by root.
My NAS box is configured to accept connections and files from my CCTV cameras, so there is not the problem.
One thing I have noticed, and why I never mentioned before , I don't know.
When I do ls on the root of pi:
pi@raspberrypi:~ $ ls Desktop Downloads Public Templates Documents Music Pictures python_games Videos pi@raspberrypi:~ $
the /mnt directory is not listed or showing, and that is because ls only lists what is under /pi while /mnt is under /
Just out of interest, I have created a /mnt directory under /pi, and also CCTV/PiZero, then changed permissions and ownership for all the directories.
I am not sure but the python script might get confused as to which /mnt directory it should use.
Advise please
Reply to
RobH
That's because you are within your "home" folder /home/pi
Why would you expect the ls command to list files that are not in the current folder, unless you specify an absolute path?
you could cd / ls
or you could ls /

Trying not to sound condescending, we all had to start somewhere, but I think for your various issues it would help you to brush up your general linux and bash knowledge, making it easier to help you ...
Reply to
Andy Burns
Ok I forgot about cd / and ls /, as it was a looong time ago when I last used it.
Anyways it took a reboot of the PiZero to sort out the permissions on /mnt.
Reply to
RobH
It can be opened now, and shows a date and time
As pointed out to me by another poster, I should have done cd / then I would have seen the /mnt directory Doh!
This now not necessary, as a solution was found
No Need thanks ------------------------------------------------------------------------
Forget or ignore most what I have written above, as I rebooted the PiZero and it has now sorted the permissions problem with the /mnt directory. Now the /mnt/CCTV/PiZero directories are all owned by pi and permissions set accordingly, including the /mnt directory.
Now the script runs without error, but, even though there was a 4.8mb file created on the PiZero, it was a 0 bytes file copied or moved to to NAS box /mnt/CCTV/PiZero.
Reply to
RobH
that
everything
Get one of the recommended Linux books and read the chapter on file ownership and permissions. Until you understand the concepts and how they work together you'll continue to struggle with this area.
The way Linux enforces file ownership and access to files is very different from Windows. In the latter where these concepts are almost nonexistent because Windows is and always was fundamentally a single-user system with a bit of rudimentary multi-user stuff bolted on while Linux inherited its multi-user way of working, and the aim of actively preventing users from interfering with each other from Unix.
--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie
On Fri, 15 Jun 2018 11:15:00 +0000 (UTC), Martin Gregorie declaimed the following:
Well, to be fair, Windows sort of inherited file permissions from MS-DOS which probably followed CP/M concepts. Though the WinNT derived variants do have stricter file protection capability, the commands to use them are rather obscure (just look at the mess the Security tab on file properties presents -- oh, and that may or may not be present in the "Home" editions... Command line? even more obscure).
OTOH: for all the comments about "trash-80", original TRS-DOS (which was replaced by a renamed LS-DOS which maintained compatibility) on the Model III gave each file /two/ passwords: owner password used to make changes to file protection level (execute, read-exec, modify-no delete, delete, full -- as I recall there were seven possible settings), and user password to just use the file at the set protection level. Common practice might be to set the user password to blank, but set the access to execute-only -- such would allow anyone to run a program, but prevent the klutzes from deleting said program. The last release of TRS-DOS 6 modified the directory structure (to permit file dates past the original 3-bit year field) and removed the user password.
--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber
On Fri, 15 Jun 2018 11:30:56 +0100, RobH declaimed the following:
That I can't really help you with -- it could be a timing problem in that the camera may still not have flushed the data to the temporary location by the time the copy to NAS operation is being invoked (though I'd have hoped a small sleep() would give the process time to complete flushing).
The only other option is to disable use of RAM to buffer the capture with a later copy to NAS... Instead, capture directly to the NAS. Possibly concerns -- network overhead impacting the camera capture process.
You would do this by (at first, for testing) commenting out the shutil and related commands (unlink(), sleep()) and changing the camera capture commands from RAMxxx to NASxxx.
--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber
When I commented out shutil and RAMxxx to NAsxxx, the script ran fine and took a video. When I then removed the comment from shutil and ran the script again, there was an error:
pi@raspberrypi:~/Downloads $ python intruder.py Traceback (most recent call last): File "intruder.py", line 37, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 13] Permission denied: '/mnt/CCTV/PiZero/2018-06-15_14.40.14.h26
This was picked up by the unlink line commented out, or however you would say it And a 0 byte file is copied to my NAS /PiZero directory.
Now when I un commented out the unlink line, the script ran without error, and a video was written to the /mnt/CCTV/Pizero directory on the PiZero. No file was copied or moved to my NAS box PiZero directory
Reply to
RobH
If you read my post at 11.30 GMT, you will see that I sort of corrected what I said in the above post.
Reply to
RobH
No you haven't - if it starts with a "/" it's in the root directory.
Reply to
Rob Morley
On Fri, 15 Jun 2018 14:47:54 +0100, RobH declaimed the following:
If you actually implemented what I was describing, the camera file should be created directly on the NAS via the mount point, and you do not want to try copying or deleting what results.]
Which sounds like it is creating the file entry in the directory, but not copying data... But, again, if you made the changes I suggested, there is no file in "RAMname" to be copied, and the file in "NASname" should already exist (I don't know if copyfile() can replace an existing file).
If the mount command worked, then "/mnt/CCTV/Pizero" (is that correct -- Linux is case sensitive and in other places you use "PiZero"?) and the NAS "PiZero" ARE THE SAME PHYSICAL DIRECTORY; any change in one should appear in the other. At worst you might have to refresh any directory display to see the changes (if you are using a GUI or web interface to view the NAS).
--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.