2016-01-17 06:16:36 +01:00
|
|
|
Usage
|
|
|
|
=====
|
2016-01-20 10:55:10 +01:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
For information on usage with Windows, see the :doc:`windows` section.
|
|
|
|
For information on using the TProxy method, see the :doc:`tproxy` section.
|
|
|
|
|
2016-01-20 11:19:44 +01:00
|
|
|
Forward all traffic::
|
2016-01-17 06:16:36 +01:00
|
|
|
|
2016-01-20 11:19:44 +01:00
|
|
|
sshuttle -r username@sshserver 0.0.0.0/0
|
|
|
|
|
|
|
|
- Use the :option:`sshuttle -r` parameter to specify a remote server.
|
2024-01-29 11:34:22 +01:00
|
|
|
On some systems, you may also need to use the :option:`sshuttle -x`
|
2020-10-21 07:05:21 +02:00
|
|
|
parameter to exclude sshserver or sshserver:22 so that your local
|
|
|
|
machine can communicate directly to sshserver without it being
|
|
|
|
redirected by sshuttle.
|
2016-01-17 06:16:36 +01:00
|
|
|
|
|
|
|
- By default sshuttle will automatically choose a method to use. Override with
|
2016-01-20 11:19:44 +01:00
|
|
|
the :option:`sshuttle --method` parameter.
|
2016-01-17 06:16:36 +01:00
|
|
|
|
|
|
|
- There is a shortcut for 0.0.0.0/0 for those that value
|
|
|
|
their wrists::
|
|
|
|
|
|
|
|
sshuttle -r username@sshserver 0/0
|
|
|
|
|
2020-05-14 22:43:33 +02:00
|
|
|
|
2020-07-04 12:02:44 +02:00
|
|
|
- For 'My VPN broke and need a temporary solution FAST to access local IPv4 addresses'::
|
2020-05-14 22:43:33 +02:00
|
|
|
|
|
|
|
sshuttle --dns -NHr username@sshserver 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
|
|
|
|
|
2016-01-20 11:19:44 +01:00
|
|
|
If you would also like your DNS queries to be proxied
|
|
|
|
through the DNS server of the server you are connect to::
|
2016-01-17 06:16:36 +01:00
|
|
|
|
2016-01-20 11:19:44 +01:00
|
|
|
sshuttle --dns -r username@sshserver 0/0
|
2016-01-17 06:16:36 +01:00
|
|
|
|
2016-01-20 11:19:44 +01:00
|
|
|
The above is probably what you want to use to prevent
|
|
|
|
local network attacks such as Firesheep and friends.
|
|
|
|
See the documentation for the :option:`sshuttle --dns` parameter.
|
2016-01-17 06:16:36 +01:00
|
|
|
|
|
|
|
(You may be prompted for one or more passwords; first, the local password to
|
|
|
|
become root using sudo, and then the remote ssh password. Or you might have
|
|
|
|
sudo and ssh set up to not require passwords, in which case you won't be
|
|
|
|
prompted at all.)
|
|
|
|
|
|
|
|
|
|
|
|
Usage Notes
|
|
|
|
-----------
|
|
|
|
That's it! Now your local machine can access the remote network as if you
|
|
|
|
were right there. And if your "client" machine is a router, everyone on
|
|
|
|
your local network can make connections to your remote network.
|
|
|
|
|
|
|
|
You don't need to install sshuttle on the remote server;
|
2021-09-22 14:13:22 +02:00
|
|
|
the remote server just needs to have python available.
|
2016-01-17 06:16:36 +01:00
|
|
|
sshuttle will automatically upload and run its source code
|
|
|
|
to the remote python interpreter.
|
|
|
|
|
|
|
|
This creates a transparent proxy server on your local machine for all IP
|
|
|
|
addresses that match 0.0.0.0/0. (You can use more specific IP addresses if
|
|
|
|
you want; use any number of IP addresses or subnets to change which
|
|
|
|
addresses get proxied. Using 0.0.0.0/0 proxies *everything*, which is
|
|
|
|
interesting if you don't trust the people on your local network.)
|
|
|
|
|
|
|
|
Any TCP session you initiate to one of the proxied IP addresses will be
|
|
|
|
captured by sshuttle and sent over an ssh session to the remote copy of
|
|
|
|
sshuttle, which will then regenerate the connection on that end, and funnel
|
|
|
|
the data back and forth through ssh.
|
|
|
|
|
|
|
|
Fun, right? A poor man's instant VPN, and you don't even have to have
|
|
|
|
admin access on the server.
|
|
|
|
|
2019-12-12 22:15:31 +01:00
|
|
|
Sudoers File
|
|
|
|
------------
|
|
|
|
|
2022-03-04 18:15:24 +01:00
|
|
|
sshuttle can generate a sudoers.d file for Linux and MacOS. This
|
|
|
|
allows one or more users to run sshuttle without entering the
|
|
|
|
local sudo password. **WARNING:** This option is *insecure*
|
|
|
|
because, with some cleverness, it also allows these users to run any
|
|
|
|
command (via the --ssh-cmd option) as root without a password.
|
2019-12-12 22:15:31 +01:00
|
|
|
|
2022-03-04 18:15:24 +01:00
|
|
|
To print a sudo configuration file and see a suggested way to install it, run::
|
2019-12-12 22:15:31 +01:00
|
|
|
|
|
|
|
sshuttle --sudoers-no-modify
|
|
|
|
|
2022-03-04 18:15:24 +01:00
|
|
|
A custom user or group can be set with the
|
|
|
|
:option:`sshuttle --sudoers-no-modify --sudoers-user {user_descriptor}`
|
|
|
|
option. Valid values for this vary based on how your system is configured.
|
2024-01-30 15:41:42 +01:00
|
|
|
Values such as usernames, groups prepended with `%` and sudoers user
|
2022-03-04 18:15:24 +01:00
|
|
|
aliases will work. See the sudoers manual for more information on valid
|
2024-01-30 15:49:56 +01:00
|
|
|
user-specified actions. The option must be used with `--sudoers-no-modify`::
|
2019-12-12 22:15:31 +01:00
|
|
|
|
2022-03-04 18:15:24 +01:00
|
|
|
sshuttle --sudoers-no-modify --sudoers-user mike
|
|
|
|
sshuttle --sudoers-no-modify --sudoers-user %sudo
|