Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Having problem with 'qpdf' command

  1. #1

    Default Having problem with 'qpdf' command

    Hi All,

    I have been having trouble with recently installed qpdf-5.3.1. I have given the following command:

    qpdf --encrypt rsp openok 40 --print=n --modify=n --extract=n infile.pdf outfile.pdf

    I am getting the error:
    qpdf: invalid encryption parameter infile.pdf

    I wonder if anyone could put me wise where I am making the mistake in the command.

    Thanks & Regards,

    RSP2

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,860

    Default Re: Having problem with 'qpdf' command

    Quote Originally Posted by rsp2 View Post
    Hi All,

    I have been having trouble with recently installed qpdf-5.3.1. I have given the following command:

    qpdf --encrypt rsp openok 40 --print=n --modify=n --extract=n infile.pdf outfile.pdf

    I am getting the error:
    qpdf: invalid encryption parameter infile.pdf

    I wonder if anyone could put me wise where I am making the mistake in the command.

    Thanks & Regards,

    RSP2
    I do not have qpdf installed, thus I do not have the man page. A search on the Internet shows that the man page only points to HTML and PDF documents that are on your system. Thus I do not have them either.

    But, my assumption is that you should study carefully how to enter the several arguments to the command. It looks as if most options are to be given as
    Code:
    --optionname=optionvalue
    as you show in your --print=, --extract= and --modify= stanzas. But the --encrypt option is not written by you like that and the rsp, openok and 40 arguments seem to be just loose words.

    Again, I have read no documentatoion, but this looks strange to me. My (wild) guess is that it should look like
    Code:
    --encrypt="rsp openok 40"
    BTW
    Please use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt. Then you need not to add superfluous talking like "I have given the following command" and "I am getting the error" because we then see all what happened exactly as you see it..

    Regards,
    Henk van Velden

  3. #3

    Default Re: Having problem with 'qpdf' command

    Hi Henk,

    Thanks for your reply. It did put me wise and I did correct the command and succeeded in encryption. But the resultant file that I got does permit copying as well as printing. 'qpdf' could not be a fake software since it was from Sourceforge. There must be something else that was wrong. I am giving below the command and the result:

    Code:
      qpdf --encrypt "rsp" "open" 40 --print=n --modify=n --extract=n -- lessons.pdf lessons-from-history.pdf
    This did produce the file 'lessons-from-history.pdf' with the passwords applied without any errors shown. But copying etc was possible on it.
    Shall be grateful for further guidance.

    Regards,

    RSP2

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,860

    Default Re: Having problem with 'qpdf' command

    Again, I do not know the product or what it should do (nor what it should do in your opionion ). I only answered because you clearly got an error on the syntax you used and I added some suggestions (only suggestions) about where to look with attention.

    While it is nice that it helped you and you do not get syntax errors any more, I doubt that you realy understand what you did (sorry). But having a word "rsp" is not different from having rsp. Same for "open" vs. open. So while there is nothing wrong with the quoting there, I doubt if you understand why you quoted there.

    Also I do not understand what you mean with "copying on lessons-from-history.pdf". Please always show what you do. Telling a story is only helping in understanding what you are doing, but it does not replace the knowledge we need about what you do.

    When you simply mean something like
    Code:
    cp somefile lessons-from-history.pdf
    (which is literaly what you say), that is of course possible. You may not be able to look in the box, but you can throw away the box and make a new box with the same name on it.
    Henk van Velden

  5. #5

    Default Re: Having problem with 'qpdf' command

    Hi Henk,

    Thanks a lot for a prompt response. The syntax seems correct because without the commas I got errors. Then I looked up on the net and came across the following syntax:
    Code:
    qpdf                 \
      --encrypt          \
        "user-password"  \
        "owner-password" \
        40               \
      --print=n          \
      --                 \
        infilename       \
        outfilename
    I just copied that syntax. It did the trick but only half way.
    I did not try 'cp' command on the terminal but from Dolphin menu itself by Edit> Select All> copy> >Paste. It did copy, although the result was somewhat warbled text that was produced.

    I did not come across any other linux application which could protect pdf files from being copied and/or printed. Passwords can be set but that does not help. Because, while sending a draft of one's work to someone for examination, that intellectual property needs to be protected.

    Anyway, Thanks a lot for your very useful tips.

    Regards,

    RSP2

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,860

    Default Re: Having problem with 'qpdf' command

    Quote Originally Posted by rsp2 View Post

    I did not try 'cp' command on the terminal but from Dolphin menu itself by Edit> Select All> copy> >Paste. It did copy, although the result was somewhat warbled text that was produced.
    Dolphin does not do anything with the contents of a file. With dolphin you can of course delete efiles, copy a file to another file (overwriting the last one completely), etc. all governed by the combination of ownership/permission of the file and the ownership/permissions of the directories in the path leading to the file. The Dolphin actions (or any other GUI file manager or CLI commands) can do that irrespective of what is in the file. The file content, encrypted or not plays no role. How could it.

    When you have a box, that is closed with a key, in your room and you do not have the key, you still can move the box to the other side of the room. You can even throw it out of the window, but you can still not see what is/was in the box.

    To protect a file against coying, removing etc, by other users (not persons, but users defined on a system), you must remove the appropriate permissions on directory and file. But when you then send the file to another system (by any means, including mount of removable mass-storage and remote mount) you are at the mercy of the system adinistrator there.

    It could be that I still do not understand your copy action, because that "warbled text" is vague to me. That is the problem with the description of actions using a GUI. Always open to misunderstanding
    Henk van Velden

  7. #7

    Default Re: Having problem with 'qpdf' command

    Hi Henk,

    What you have said is very understandable. I have since used the command line as well. The results are as under. 'ls -al' has given the following:

    Code:
    -rw------- 1 rsp users 15482902 Oct  4 10:14 lessons-from-history.pdf
    Hence, according to what you say, the file 'lessons-from-history.pdf' cannot be coppied by 'group' and 'others'. But could it be printed by others? I suppose not because for printing, a copy has to be made. Please do correct me if my understanding is wrong.

    Thanks & Regards,

    Sincerely,

    RSP2

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,860

    Default Re: Having problem with 'qpdf' command

    I think you must refresh your knowledge about permissions.
    The -rw------- shows that only the owner (rsp) can read and write the file (and printing involves reading of course). But it says nothing about who may delete (or replace the file completely, which a delete and a create). Because that involves writing in the the directory the file resides in.

    Thus when the directory has e.g. the permissions drwxrwxr-x and the same user:group as owner, every user that belongs to the group users can delete the file because all users in group users have write access to the directory. Might sound a bit strange, but is very logical when you understand the principles of Unix/Linux ownership/permissions and understand what is stored in a directory (and thus understands what can be done with write access to a directory).

    And even when the directories permission are drwxr-zr-w (they most of the time are), the owner rsp can still remove the file without any questions asked.

    Again, try to understand the metaphore with the box in the room. Everybody that can enter the room can throw the box in the open fire. But only the owner can open it and read and write (and in your case the box then, as an extra, asks you to have the key).
    Henk van Velden

  9. #9

    Default Re: Having problem with 'qpdf' command

    Hi Henk,

    Yes, you are right. I have just about the working knowledge of Linux and do not claim any deeper knowledge. Basically a writer, the permissions of directories and files are important for me to safeguard my work. Hence, I shall endeavour to study up.

    The total result of the 'ls -al' on the directory containing this file is given below.

    Code:
    rsp@linux-newdell:~/mw/1our-military-heritage/book-rev2/pdf> ls -al
    total 64140
    drwxr-xr-x 2 rsp users     4096 Oct  5 18:39 .
    drwxr-xr-x 7 rsp users     4096 Oct  5 19:39 ..
    -rw------- 1 rsp users 15482902 Oct  4 10:14 lessons-from-history.pdf
    -rw-r--r-- 1 rsp users 15512489 Oct  2 20:21 lessons.pdf
    rsp@linux-newdell:~/mw/1our-military-heritage/book-rev2/pdf>
    From the above it seems that while rsp has all the rights, anyone of the group could delete the directory, but others could only excess it.
    Now, what should be done to secure it further?
    The other question that is nagging me is that would these permissions hold in other operating systems such as Windows etc?

    I am sorry to bother you with these questions which for you must be basic.

    Thanks & Regards,

    RSP2

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,860

    Default Re: Having problem with 'qpdf' command

    You can only protect from users on this very system of course. E.g. when this is about a laptop where only rsp is defined as a user (I mean as user that uses the system for work, there are always more users, but they are for system usage and will not login), there is no real reason to bother about the users of the group users because there aren't any. The same for all other users, because there aren't any.

    But these protections are functioning on the Operating System level. which means that when you copy the file to an USB stick (with a non Linux file system like NTFS) the ownership and permission bits are not copied (because NTFS does not have them). And when you then copy them from the stick to a Windows system, you can only live with what a Windows systems offers (of which I do not know much).

    That is, I guess, one of the reasons that having protection inside the file is done with that encrypting and password. Because when it is in the file, it will travel with it.

    Again you can move the box from the room it is in to another room, or even house. That other house can have a complete different system of room protection (maybe even all doors open), but the box still needs the key to look inside.

    BTW is my room/box metaphore of any use in helping you understanding these basics?


    (Will make a separate post about what the ls -la shows).
    Henk van Velden

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •