LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 07-03-2009, 10:28 PM   #1
routers
Member
 
Registered: Aug 2005
Location: Malaysia - KULMY / CNXTH
Distribution: Slackware, Fedora, FreeBSD, Sun O/S 5.10, CentOS
Posts: 749
Blog Entries: 6

Rep: Reputation: 74
/zones/ vi "/etc/hosts" [Read only]


Hi guys
I want to find out how to solve this problem
the senario is i work under zfs zones, using vi editor
trying to edit /etc/hosts (zone itself- full zone), but it said "read only"
when i want to save it with :wq

next trying i use # echo "192.168.1.10 test test" >> /etc/hosts
its writeable to the file

and next i install nano from sunfreeware, by using nano
i can edit and save w/o any problem.

the main point is how to use vi for that such file condition
any help is appreciated for future usage

thanks

(Solaris 10 5/09 s10s_u7wos_08 SPARC)
 
Old 07-04-2009, 12:12 AM   #2
f14f21
Member
 
Registered: Sep 2008
Distribution: rhel
Posts: 42

Rep: Reputation: 6
i conclude from what you said that nano gonna ignore read-only attribute of file and vi not .
it's so bad to ignore read-only
i cant find any parameter for vi to bypass readonly attribute flag
in my idea the only way is to set write access to the file :
#chmod +w /etc/hosts
 
Old 07-04-2009, 02:15 AM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,482

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
This is unrelated to zones. When you are root, you can write a read-only file with vi by appending + to the command used. eg:
Code:
:wq!
or better
Code:
:x!
 
Old 07-04-2009, 03:14 AM   #4
routers
Member
 
Registered: Aug 2005
Location: Malaysia - KULMY / CNXTH
Distribution: Slackware, Fedora, FreeBSD, Sun O/S 5.10, CentOS
Posts: 749
Blog Entries: 6

Original Poster
Rep: Reputation: 74
Quote:
Originally Posted by jlliagre View Post
This is unrelated to zones. When you are root, you can write a read-only file with vi by appending + to the command used. eg:
Code:
:wq!
or better
Code:
:x!


its worked with that :x!

after that i go down long vi man page again
found it states there :w! its forced write if permission originally not valid

i takes note, thanks a lot

ps: now i blame man page, why didnt state ":w! override read only file"
because when i want to save its stated read only
btw sorry my english

but thanks again for clear it up
 
Old 07-04-2009, 04:47 AM   #5
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,482

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Agreed, the manual page should have been clearer on that point.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Getting "Short read in buffer_copy" error with "dpkg" stalefries Linux - Software 6 03-24-2010 03:19 PM
What is the difference between "/etc/hosts.equiv" AND ".rhosts" ? kcarun Solaris / OpenSolaris 15 08-06-2009 11:46 PM
"yum update" killed my DNS zones on VMware Server 1.0.3 girarde Linux - Server 4 04-20-2009 10:22 PM
How to read "identify" button press event, or state of "identify" blue led with IPMI? iav Linux - Server 0 01-27-2009 01:13 PM
Edit "read-only" /etc/fstab from "System Recovery#" (without boot cd?) charlweed Linux - General 1 12-31-2006 05:57 PM


All times are GMT -5. The time now is 01:55 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration