LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-25-2005, 01:05 AM   #1
Ammad
Member
 
Registered: Apr 2004
Distribution: redhat 9.0, fc4, redhat as 4
Posts: 522

Rep: Reputation: 31
permission


root user created a new file in /home/neo/file1
and set the permissions

#chmod 644 /home/neo/file1

when user neo log in and open the file named file1, in vi editor a message at botom [Read only file].
so after that neo change the file and quit using


:wq!




and changes successfully updated , file1 owner is root, group is root, and neo is not member of root group.


why this can be in vi , not in pico .


thanks take care coz i care
 
Old 05-25-2005, 07:00 PM   #2
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Rep: Reputation: 47
Hmmm... that is weird.
Code:
root@bsubuntu:/home/bs # touch test.txt
root@bsubuntu:/home/bs # ls -l test.txt
-rw-r--r--  1 root root 0 2005-05-25 18:57 test.txt
root@bsubuntu:/home/bs #

bs@bsubuntu:~$ ls -l test.txt
-rw-r--r--  1 root root 0 2005-05-25 18:57 test.txt
bs@bsubuntu:~$

bs@bsubuntu:~$ vi test.txt     (said read only.  saved it with :wq! )
bs@bsubuntu:~$ ls -l test.txt
-rw-r--r--  1 bs bs 5 2005-05-25 18:58 test.txt
bs@bsubuntu:~$
A dangerous thing, eh?

Sorry, don't know about pico.

Uh, and why is this in the networking forum?

Last edited by itsjustme; 05-25-2005 at 07:02 PM.
 
Old 05-25-2005, 07:07 PM   #3
mjrich
Senior Member
 
Registered: Dec 2001
Location: New Zealand
Distribution: Debian
Posts: 1,046

Rep: Reputation: 45
Yes, it is a rather strange feature of Vim...

It can be switched off by setting the cpoption "W" flag (see http://www.vim.org/htmldoc/editing.html#write-quit), though why it's there in the first place beats me. Only the account owner of /home/foobar can take ownership of files in their own directories using wq!, thus considering that they can't give away ownership after taking it, I guess it's not as bad as it sounds...

Cheers,

mj

Last edited by mjrich; 05-25-2005 at 07:09 PM.
 
Old 05-25-2005, 10:49 PM   #4
Ammad
Member
 
Registered: Apr 2004
Distribution: redhat 9.0, fc4, redhat as 4
Posts: 522

Original Poster
Rep: Reputation: 31
thanks mjrich for sharing knowledge
 
Old 05-26-2005, 12:12 AM   #5
mjrich
Senior Member
 
Registered: Dec 2001
Location: New Zealand
Distribution: Debian
Posts: 1,046

Rep: Reputation: 45
Incidentally:
Code:
root:/home/test# touch foobar.txt
root:/home/test# ls -lh
total 0
-rw-r--r--   1 root    root       0 2005-05-26 16:50 foobar.txt

root:/home/test# exit
exit

user@debian:~$ rm foobar.txt 
rm: remove write-protected regular empty file `foobar.txt'? y

user@debian:~$ ls -lh
total 0
user@debian:~$
Which isn't too different from being able to write to a read-only file. Of course, outside the user's home directory, a 'permission denied' error is returned.

Cheers,

mj
 
Old 05-26-2005, 02:18 AM   #6
kees-jan
Member
 
Registered: Sep 2004
Distribution: Debian, Ubuntu, BeatrIX, OpenWRT
Posts: 273

Rep: Reputation: 30
Hi,

When saving a file, an editor (vi or pico or whatever) can do two things:
1. Write new data to the old file. Causes "permission denied" in this case. Apparently pico does this.
2. Alternatively, rename the oldfile to backup (or remove it alltogether) and create an entirely new file containing the new content. In order to do this, you need write permission for the directory the file is in, not for the file itself. Apparently, this is vi behaviour.

Groetjes,

Kees-Jan
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 04:50 AM
Why don't I have permission ben_h_24 Linux - Newbie 19 09-17-2005 12:51 PM
Permission Infinite_Pizza Linux - General 5 04-20-2004 09:40 PM
Permission help again iLLuSionZ Linux - Newbie 12 11-23-2003 08:35 AM
permission help! beautifulmind Linux - General 1 07-24-2002 03:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration