Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 21
Hi folks, How to lock a file of following format 1) .txt or .doc 2) .html or .htm so that it can be read only. Copying its content with copy/paste ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,808

    How to lock a file


    Hi folks,

    How to lock a file of following format

    1) .txt or .doc
    2) .html or .htm

    so that it can be read only. Copying its content with copy/paste command is not allowed, nor duplicating it. Kinldy advise.

    TIA

    B.R.
    satimis

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    This should work:
    Code:
    chmod 444 file
    This sets the 'read' bit to one and all other bits to zero, since you don't seem to be dealing with executables.

  3. #3
    Just Joined!
    Join Date
    Feb 2003
    Posts
    37
    It's impossible to prevent duplication of a file if it can be read.

  4. #4
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Just giving him the closest thing I could come up with

  5. #5
    Just Joined!
    Join Date
    Feb 2003
    Posts
    37
    Actually, I was commented on the original post, but now that I think about it.

    chmod 400 file

    Use that to prevent anyone, except the file owner from reading(or duplicating) the file.

  6. #6
    Linux User IsaacKuo's Avatar
    Join Date
    Feb 2005
    Location
    Baton Rouge, LA, USA
    Posts
    406
    The basic problem is that the term "read-only" has a particlar meaning in computer jargon, and it does NOT mean what satimis hopes it means.

    In computer jargon, "read-only" means that the file/device can't be written to (as opposed to "read-write" or "write-only). This doesn't imply any restrictions on what the person or program reading from the file/device does with the data.

    Anywaaaaays, what are we doing here instead of on JustLinux, anyway?
    Isaac Kuo, ICQ 29055726 or Yahoo mechdan

  7. #7
    Linux Enthusiast
    Join Date
    Dec 2004
    Location
    Rockin' in the USA!!!
    Posts
    603
    ^^I think we all know that, but rather, we're trying to provide a solution for him. Although I don't think it's possible to do what you're asking, you can change group permissions, that might give you something close to what you're looking for.

  8. #8
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,808
    Hi folks,

    Tks for your advice and postings.

    I came across such files on web. I was not allowed to high-light their contents and paste the same to another file. I'm interested to learn how to do it.

    However I can print such a file as a .pdf file. So if we can stop this last job then the file shall become read only. To touch it is impossible.

    satimis

  9. #9
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    you can acheive those locked html files on the web via javascript, but that won't apply to accessing them locally.

  10. #10
    Just Joined!
    Join Date
    Feb 2003
    Posts
    37
    Quote Originally Posted by IsaacKuo
    Anywaaaaays, what are we doing here instead of on JustLinux, anyway? :wink:
    Here's my return message. :)
    http://www.linuxforums.org/forum/post-181397.html


    Quote Originally Posted by lakerdonald
    you can acheive those locked html files on the web via javascript, but that won't apply to accessing them locally.
    Generally, this is false. You can copy the content, you just have to copy from the page source instead. (Or save the page to disk, edit out the javascript, then re-open it locally.)

    As for copying text from a pdf file: That's similar to trying to copy text from a graphic file. If you want to stop people from copying your text, only post screenshots of the text, instead of the actual text. (But that still won't stop people from duplicating the file.)

Page 1 of 3 1 2 3 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
  •