Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 Dec 2008 10:32:48 +0100
From:      Adam Zaleski <talk@holon.urwis.cc>
To:        freebsd-questions@freebsd.org
Subject:   Problem with permissions and vi
Message-ID:  <493500C0.3030202@holon.urwis.cc>

next in thread | raw e-mail | index | archive | help
Hello,

I have a problem setting up some permissions to file
and editing this file with vi.. I have two different
examples to show you what I mean... First one:

[netlest@unixlab ~]$ echo "some text" > some_file.txt
[netlest@unixlab ~]$ chmod 000 some_file.txt
[netlest@unixlab ~]$ ls -l some_file.txt
----------  1 netlest  staff  10  2 gru 09:55 some_file.txt
[netlest@unixlab ~]$ echo "some other text" >> some_file.txt
-bash: some_file.txt: Permission denied
[netlest@unixlab ~]$ cat some_file.txt
cat: some_file.txt: Permission denied
[netlest@unixlab ~]$ chmod 600 some_file.txt
[netlest@unixlab ~]$ cat some_file.txt
some text
[netlest@unixlab ~]$


Everythink was ok...

And now.. another one
[netlest@unixlab ~]$ echo "some text" > some_file.txt
[netlest@unixlab ~]$ chmod 000 some_file.txt
[netlest@unixlab ~]$ ls -l some_file.txt
----------  1 netlest  staff  10  2 gru 09:55 some_file.txt
[netlest@unixlab ~]$ vi some_file.txt

Now ignore warnings with permission denied showing in vim..
and put some text into the some_file.txt and then :wq!

[netlest@unixlab ~]$ ls -l some_file.txt
----------  1 netlest  staff  33  2 gru 10:23 some_file.txt
[netlest@unixlab ~/t]$ cat some_file.txt
cat: some_file.txt: Permission denied
[netlest@unixlab ~/t]$ chmod 600 some_file.txt
[netlest@unixlab ~/t]$ cat some_file.txt
aasda
sd
a some texs
asdas
d
as
[netlest@unixlab ~/t]$


Why I am able to put some text into some_file.txt with
chmod 000 using vi editor and why i can not do the same
using echo???









Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?493500C0.3030202>