LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-10-2004, 04:23 AM   #1
rohan208
Member
 
Registered: May 2004
Posts: 75

Rep: Reputation: 15
creating file with default text..how to?


Hello,
there is a perticular file on my system,
/proc/sys/net/ip_forward, whose content is set to 0 every time the pc is restarted. I want to ensure that it is set to 1 before i run my other automated tasks. how do i get about doing this?
I think we can do something like
Code:
$ ls > filename
but that would put the contents of directory in file. How do i get rid of the 0 and make that a 1?
thx
 
Old 05-10-2004, 04:49 AM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
/proc file system is just a representation of the kernel, and what the kernel see's, it takes up no hard drive space (except for the directory listing, with hardly counts as space on most file systems)

use echo to change the contents.. I'm not sure on the syntax, but something like

echo /proc/sys/net/ip_forward > 1
should change the value to 1, if you always want it like that, then it'll require you reconfigure and recompile the kernel
 
Old 05-10-2004, 04:52 AM   #3
slano
Member
 
Registered: May 2003
Distribution: slack,gentoo
Posts: 57

Rep: Reputation: 16
just add this command "echo 1 > /proc/sys/net/ip_forward" to you rc.local (or somewhere where it will start automatically after each reboot, depending on your distro). this will do the trick

Last edited by slano; 05-10-2004 at 04:53 AM.
 
Old 05-10-2004, 04:53 AM   #4
rohan208
Member
 
Registered: May 2004
Posts: 75

Original Poster
Rep: Reputation: 15
Thx SciYro and slano,
Ill try that out, I just want that line to go to 1 before i load my program, so i think it sould be fine without the recompile.
yea adding the line to rc.local sounds better than making a script file and loading it every time user logs in.
thx

Edit:
works as root.
however i want a perticular user in the group "root" to be able to write to file. So i did
Code:
$chmod 664 /proc/sys/net/ipv4/ip_forward
and i get error saying
Code:
chmod:changing permission of ip_forward:(requested0664, actual 0644) Permission denied
I dont understnd why i am getting this error. I am su'd as root.

Last edited by rohan208; 05-10-2004 at 05:04 AM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which light text editor can copy text from file and paste in browser? davidas Linux - Software 9 03-06-2006 11:28 AM
How to find and change a specific text in a text file by using shell script Bassam Programming 1 07-18-2005 07:15 PM
Replace text of unknown content with other text in file brian0918 Programming 15 07-14-2005 09:22 PM
need help creating default grub configure file. dr_zayus69 Linux - Software 6 02-28-2005 08:09 AM
Default mode for opening text file qcoder Programming 4 05-24-2004 06:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:35 AM.

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