LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-28-2008, 05:53 PM   #1
wilsonsamm
Member
 
Registered: Aug 2005
Location: Sheffield, UK
Distribution: Gentoo
Posts: 105

Rep: Reputation: 15
setting up port forwarding, but write access to /proc/.../.../... denied


Hello everyone.
I have been following the guide at http://www.ubuntugeek.com/sharing-in...in-ubuntu.html for setting up my ubuntu computer to permit a second computer to hook up to the internet through it.

Well, I reached the step of doing this:
# echo 1 > /proc/sys/net/ipv4/ip_forward
But now my computer is denying me access. Even with sudo. It's telling me:
bash: /proc/sys/net/ipv4/ip_forward: Permission denied

How may I proceed?
 
Old 04-28-2008, 06:02 PM   #2
fancylad
Member
 
Registered: Mar 2008
Distribution: slackware
Posts: 175

Rep: Reputation: 19
Good luck with that one. I encountered the exact same problem at work with Ubuntu. I didn't look too much into the problem. My solution was to just install Debian. Try looking at the permissions. Maybe write access is disabled for some reason. You also might want to try actually logging in as root. I don't see why this would make a difference, but I'm no sudo expert so who knows. Ubuntu doesn't allow this by default because there is no password set for the root account. Change this by doing "sudo passwd root" and creating one.
 
Old 04-28-2008, 06:11 PM   #3
wilsonsamm
Member
 
Registered: Aug 2005
Location: Sheffield, UK
Distribution: Gentoo
Posts: 105

Original Poster
Rep: Reputation: 15
What? logging in as rootfixed the problem. I just changed the password with sudo passwd root and then
su
echo 1 > /proc/sys/net/ipv4/ip_forward
worked. I'm quite confused. Ah well. Once I've finished writing this essay on early cinematography in the Soviet Union I'll install good old Debian proper.
 
Old 04-28-2008, 06:33 PM   #4
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by wilsonsamm View Post
...Well, I reached the step of doing this:
# echo 1 > /proc/sys/net/ipv4/ip_forward
But now my computer is denying me access. Even with sudo. It's telling me:
bash: /proc/sys/net/ipv4/ip_forward: Permission denied
I saw something very similar when I tried to do some firewalling scripting on Ubuntu quite some moons ago. As far as I remember, the solution that I came up with was to use sysctl rather than echoing data at the proc filesystem, though I never knew why what you tried didn't work (& it had worked on an older Red Hat style system). Log in as root, you say. Hmmm. That would have meant running my firewall generator script as root, which wouldn't exactly have been desirable, but I'll bear it in mind.

Quote:
How may I proceed?
Well, you have my permission to proceed any way you like. Not that that counts for much. Debian doesn't sound like such a bad idea compared to windows-ified linux, you know.
 
Old 04-30-2008, 01:05 PM   #5
wilsonsamm
Member
 
Registered: Aug 2005
Location: Sheffield, UK
Distribution: Gentoo
Posts: 105

Original Poster
Rep: Reputation: 15
For some reason that installation of Ubuntu decided not to ever hook me up to the internet again. I went and installed Debian etch which I'm using at the moment.
It has a few glitches still which I'm about to iron out, but can anyone recommend me a good solution to connect my laptop through eth1? I want to access the X server through my laptop, do some file sharing between the two computers &c.
 
Old 04-30-2008, 09:10 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The problem with your original command "sudo echo 1 >/proc/net/ipv4/ip_forward" is that the redirection is done by the shell before the sudo command runs. So the effective uid is still the regular user at that point. You can run into the same situation using pipes as well. For a simple echo command you could put the entire echo command inside single quotes. The shell will then present the entire line to sudo instead of doing the redirection first. A more complicated example is given in the sudo manpage:
sudo sh -c "cd /home ; du -s * | sort -rn > USAGE"

Of course you need permission to use sudo according to the sudoer file. If there was a sudo based denial, it will be logged in /var/log/messages.
If it was a permission problem then the single quotes trick may work.

Last edited by jschiwal; 04-30-2008 at 09:56 PM. Reason: fixed typo
 
Old 01-05-2010, 04:16 PM   #7
sfkoldun
LQ Newbie
 
Registered: Jan 2010
Posts: 1

Rep: Reputation: 0
run:
sudo -i

and then
echo 1 > /proc/sys/net/ipv4/ip_forward
 
  


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
Samba write access denied Ab3n Linux - Server 9 04-20-2007 05:04 PM
Squid url port 81 access-denied error steve@korehicom.com Linux - Networking 0 10-13-2005 09:55 AM
Partition: write access denied linmix Linux - Software 7 10-08-2005 06:11 PM
Write access denied in Vi Hockeyfan Linux - Software 2 07-16-2005 11:03 PM
NFS write access denied on one of two filesystems TomF Linux - Security 2 02-23-2005 08:48 PM

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

All times are GMT -5. The time now is 12:59 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