setting up port forwarding, but write access to /proc/.../.../... denied
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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.
...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.
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.