P=python2: Command not found.

1,140 views
Skip to first unread message

Joseph Winston

unread,
Jan 24, 2012, 4:18:05 PM1/24/12
to sshu...@googlegroups.com
Warning -- New User.

I've cloned the git repository and installed it on 10.6.8.  When I try to run the command line example with the hostname, which is a ubuntu Ubuntu 10.04.3 LTS, replaced with the appropriate name

$ ./sshuttle -r hostname 0.0.0.0/0 -vv

The output is:

Starting sshuttle proxy.
Binding: 12300
Listening on ('127.0.0.1', 12300).
firewall manager ready.
c : connecting to server...
c : executing: ['ssh', 'hostname', '--', 'P=python2; $P -V 2>/dev/null || P=python; exec "$P" -c \'import sys; skip_imports=1; verbosity=2; exec compile(sys.stdin.read(764), "assembler.py", "exec")\'']
josephwinston@hostname's password: 
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
c :  > channel=0 cmd=PING len=7 (fullness=0)
P=python2: Command not found.
P: Undefined variable.
c : fatal: server died with error code 1

When I ssh to that machine, python is on my path:

$ type -a python
python is /usr/bin/python

Changing ssh.py to explicitly hardwire the path like this:

diff --git a/ssh.py b/ssh.py
index c4bf06e..75eb193 100644
--- a/ssh.py
+++ b/ssh.py
@@ -84,7 +84,7 @@ def connect(ssh_cmd, rhostport, python, stderr, options):
         if python:
             pycmd = "'%s' -c '%s'" % (python, pyscript)
         else:
-            pycmd = ("P=python2; $P -V 2>/dev/null || P=python; "
+            pycmd = ("P=/usr/bin/python; "
                      "exec \"$P\" -c '%s'") % pyscript
         argv = (sshl + 
                 portl + 

doesn't work either.  

What did I miss?

Brian May

unread,
Jan 24, 2012, 6:00:16 PM1/24/12
to sshu...@googlegroups.com
On 25 January 2012 08:18, Joseph Winston <josephwi...@gmail.com> wrote:
> P=python2: Command not found.
> P: Undefined variable.

What sort of computer are you trying to connect to? It seems like
maybe you don't have a sh compatible shell on this system; please try
the following commands and report the results here.

ssh hostname "echo \$SHELL"
ssh hostname "P=/usr/bin/python; echo \$P"

If hostname isn't your remote host, replace it with your real remote
host of course.
--
Brian May <br...@microcomaustralia.com.au>

Joseph Winston

unread,
Jan 24, 2012, 7:28:29 PM1/24/12
to sshu...@googlegroups.com
I've downloaded the app from Sshuttle VPN.app and it works fine on my mac and ubuntu system.  

Now for the debugging:

$ ssh hostname "echo \$SHELL"
/bin/tcsh

$ ssh hostname "P=/usr/bin/python; echo \$P"
P=/usr/bin/python: Command not found.
P: Undefined variable.

Ok, so I must be the last person on the world that still uses csh.

Joseph Winston

unread,
Jan 24, 2012, 8:48:02 PM1/24/12
to sshu...@googlegroups.com

Brian May

unread,
Jan 24, 2012, 10:27:11 PM1/24/12
to sshu...@googlegroups.com
On 25 January 2012 11:28, Joseph Winston <josephwi...@gmail.com> wrote:
> I've downloaded the app from Sshuttle VPN.app and it works fine on my mac
> and ubuntu system.

Ok, good.


> Now for the debugging:
>
> $ ssh hostname "echo \$SHELL"
> /bin/tcsh

I would assume another option that should work would be to pass the
"--python /usr/bin/python" flag to sshuttle. If I read the code
correctly, it should use the first form of the pycmd, which I think
should work.
--
Brian May <br...@microcomaustralia.com.au>

Joseph Winston

unread,
Jan 24, 2012, 10:57:44 PM1/24/12
to sshu...@googlegroups.com
Thanks the --python option works like a champ.

Reply all
Reply to author
Forward
0 new messages