LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-27-2009, 12:46 AM   #1
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Rep: Reputation: 69
I got a few noob questions...


I am running Slackware 12.0

1. Why is it that I cannot change permissions on /proc/sys/net/ipv4/ip_forward as root?

I ran ls -l ip_forward and root is the owner. So I want to be able to give other groups permission to write to the file. So as root, I run

chmod o+w ip_forward

but I get

chmod: changing permissions of `ip_forward': Operation not permitted

Why is this so? I mean, I'm running it as root. Do I need to run it with kernel privileges? If so, how do I do that?

2. I want to make 120 files like file1, file2, file3, file4, etc
What command would I use? I guess I'd need some sort of bash script.

while i!=120; export i=1; touch file[i]; i++;

How would I script that? Or what command would I use?
 
Old 02-27-2009, 02:44 AM   #2
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Original Poster
Rep: Reputation: 69
I solved question 2.

#!/bin/bash
i=0
while [ $i -lt 21 ]; do
touch file$i
let i=i+1
done

easy as pie, Linux Rulez!!

Any of you guys know the answer to question 1?
 
Old 02-27-2009, 08:39 AM   #3
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 56
Why did you want to write to /proc/sys/net/ipv4/ip_forward?
 
Old 02-27-2009, 08:41 AM   #4
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Original Poster
Rep: Reputation: 69
so i can turn my nic into a router, so why can't i change the permissions as root?
 
Old 02-27-2009, 08:44 AM   #5
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 56
So you want echo 1 > /proc/sys/net/ipv4/ip_forward
What guide are you using?
 
Old 02-27-2009, 08:56 AM   #6
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Original Poster
Rep: Reputation: 69
I want to understand why even if the file ip_forward has root as its owner, why I can't change permissions as root giving o+x to others, or maybe even adding a suid flag to it, which also returns the same error.

I'm experimenting with some pentesting tools. I want the nic to simply forward the packets, but I want to be able to write to ip_forward as a normal user.

Last edited by trist007; 02-27-2009 at 08:58 AM.
 
Old 02-27-2009, 09:07 AM   #7
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 56
This should help;
http://www.google.com/search?hl=en&q...q=%2Fproc+file
 
Old 02-27-2009, 09:32 AM   #8
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Original Poster
Rep: Reputation: 69
Thank you, sudo -i fixed the problem.
 
Old 03-02-2009, 09:08 PM   #9
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
Back to problem 2,
Code:
touch file{1..120}
will do the trick. If you want to pad the #'s, then try:
Code:
touch file`seq -ws " file" 120`
Suggested reading:
1) man bash, search (case sensitive) for "Brace Expansion"
2) man seq
 
  


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
A few noob questions... Cygnus Linux From Scratch 5 08-26-2008 02:03 AM
I got a few more noob questions trist007 Linux - Newbie 4 06-22-2008 03:42 PM
I got a few noob questions trist007 Linux - Newbie 16 06-18-2008 02:28 PM
a few noob questions... xsithlordx Linux - Newbie 7 11-19-2005 06:22 PM
Questions from a noob Linux_n00b_57 Linux - Games 5 07-08-2005 05:11 PM


All times are GMT -5. The time now is 10:12 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration