Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

A file copied from a NTFS share has become read-only, other files in the same folder are OK.

Finder's Info says in the Sharing & Permissions:

You can only read 
Name        Privilege 
myname (Me) Read & Write 
admin       Read only 
everyone    Read only

ls -l@

total 142040
-rwxr-xr-x  1 myname admin  5388424 Sep 17  1998 Bad File
-rwxr-xr-x  1 myname admin  3534780 Feb  3 21:36 Good File

How to undo? chown/chmod didn't do anything...

share|improve this question
    
What type of file is it? How do you know it is read-only? –  zevlag Feb 3 '11 at 21:14
    
I try to edit it, or change its properties/permissions in the Finder, and it doesn't let me. In addition, "You can only read" in Finder's Info is a hint as well. –  MaxVT Feb 4 '11 at 8:58

2 Answers 2

up vote 3 down vote accepted

Try ls -lO to see if any file flags are set. If it's locked (uchg flag), you can unlock it in either the Finder's Get Info window, or with chflags nouchg "Bad File". If some other flag is set, use chflags no<whatever> "Bad File" to clear it.

EDIT: The -O flag to la adds another column between the group and size of the files, listing file flags (if any). Note that flags are entirely separate from extended attributes (what -@ displays). Here's an example:

$ touch "Normal File" "Locked File" "Invisible, Append-only File"
$ chflags uchg "Locked File"
$ chflags uappnd,hidden "Invisible, Append-only File"
$ ls -l
total 0
-rw-r--r--@ 1 gordon  wheel  0 Feb  4 07:24 Invisible, Append-only File
-rw-r--r--  1 gordon  wheel  0 Feb  4 07:24 Locked File
-rw-r--r--  1 gordon  wheel  0 Feb  4 07:24 Normal File
$ ls -lO
total 0
-rw-r--r--@ 1 gordon  wheel  uappnd,hidden 0 Feb  4 07:24 Invisible, Append-only File
-rw-r--r--  1 gordon  wheel  uchg          0 Feb  4 07:24 Locked File
-rw-r--r--  1 gordon  wheel  -             0 Feb  4 07:24 Normal File

The uchg flag is what gets set if you check the "Locked" box in a file's Get Info window. BTW, the "hidden" flag only affects the Finder -- the only way to hide files from the command line is to put a . at the front of the filename.

share|improve this answer
    
Dunno if that's going to fix his problem but good answer nonetheless +1 –  conorgriffin Feb 3 '11 at 21:47
    
The file was indeed locked. Could you please expand on how to identify the uchg flag in the ls output? –  MaxVT Feb 4 '11 at 9:03

Another method of unlocking said file would be in Finder itself. Under the General expansion of Get Info. This toggles the uchg flag.

Get Info Box

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.