1828884 Members
3026 Online
109985 Solutions
New Discussion

problem with "chatr"?

 
Stanley_8
Advisor

problem with "chatr"?

I try to change a program's attribute but it return the message as follows:

chatr(error): cannot open file for writing

Why?
4 REPLIES 4
David_246
Trusted Contributor

Re: problem with "chatr"?

Hi Stanely,

If you do a man on chatr it will explain you quiet some, you even need a lot of time :)

In fact it's the same as "chmod". I don't know why you are calling chatr directly.

Just use chmod 777 /path/to/file
or other options to change permissions.

-------

The reason because of the error is in this case mostly that the directory is not writeable by you. When you do an ls there is nothing more done then a kind of cat from the directory, so the directory is a file. When changing filepermissions you therefor edit the (directory)file. check this using : ls -lad /path/to/dir/
This on it's turn you could change by a chown or again the "chmod xxx /path/to/dir/"

For any more questions please let us know.

Regs David
@yourservice
V. V. Ravi Kumar_1
Respected Contributor

Re: problem with "chatr"?

Frank Slootweg
Honored Contributor

Re: problem with "chatr"?

With chatr(1) you change the *content* of the file, i.e. not just the attributes. In order to change the content, you must have write permission ("w" bits in the ll(1) output). Probably you had no write permission.

Note that chatr is *not* the same as chmod.
David_246
Trusted Contributor

Re: problem with "chatr"?

Hi Frank,
You are right, chatr does more. As he stated he tried to change a program's attribute I mentioned it this way.
Thanks for setting things straight.

Regs David
@yourservice