If you can read a file but can’t write it, you can copy the file and make your changes in the copy.

If you need to change a read-only file, what you should do is find the owner of the file and have its permissions changed. But if you can’t find the owner of the file, and your changes really must be done immediately, you can also just copy the file and make your changes in the copy:

    % cp 
 updates ~/updates.mine
    % vi ~/updates.mine
    (edit as needed)

The only caveat is that you need to make sure that your “new” version of the file is copied over the “real” version before more changes are made to it. So send email to the owner:

    % mail mike
    Subject: updates file

    Hey, I needed to make changes to updates, but I didn't have
    write permission, so I made my changes into a copy in my
    home directory named updates.mine. Please stay out of the
    updates file for now. I'll let you know when the changed
    version can be copied into the original.

Otherwise you risk having to merge changes from two different versions of the file.

Get WYNTK: UNIX System Admininistrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.