On 07/25/16 14:35, Dick Steffens wrote:
> On 07/25/2016 09:48 AM, Russell Senior wrote:
>>
>>>> Aha!  I remember now, you need to turn on forwarding on the X200.
>>>>
>>>> Check "cat /proc/sys/net/ipv4/conf/all/forwarding" ... it is probably 0.
> 
> It is.
> 
>>>> If so, "echo 1 > /proc/sys/net/ipv4/conf/all/forwarding" will turn it
>>>> on.  You can add this to your script with the iptables rule.
> 
> First I tried:
> 
> rsteff@ThinkPad-X200-Tablet:~$ sudo echo 1 > 
> /proc/sys/net/ipv4/conf/all/forwarding
> bash: /proc/sys/net/ipv4/conf/all/forwarding: Permission denied
> rsteff@ThinkPad-X200-Tablet:~$
> 
> Note that I was not asked for a password.
> 
> Then I tried it without sudo:
> 
> rsteff@ThinkPad-X200-Tablet:~$ echo 1 > 
> /proc/sys/net/ipv4/conf/all/forwarding
> bash: /proc/sys/net/ipv4/conf/all/forwarding: Permission denied
> rsteff@ThinkPad-X200-Tablet:~$

Beating a very old horse here, but I've been intending to respond to
this.  The reason these commands are failing is that redirection ('>')
is performed by your original shell, not sudo.  Your rsteff account
doesn't have permission to write to files in the /proc directory, hence
the error.  Others have shown that you can just get a root shell and
then issue the echo command, but I wanted to point out that you can do
this from a single command.

This command invokes a root shell and then passes the desired command,
including redirection, to that shell.

sudo /bin/sh -c 'echo 1 > /proc/sys/net/ipv4/conf/all/forwarding'


<http://stackoverflow.com/questions/82256/how-do-i-use-sudo-to-redirect-output-to-a-location-i-dont-have-permission-to-wr>


galen
-- 
Galen Seitz
[email protected]
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to