# Always on

A tunnel that is up whenever the machine runs, with nobody logged in. Use it on a machine that other programs or other computers use as their way to the server, or for a [remote endpoint](Remote-Endpoints.md).

## Windows service

1. Put `CrushTunnel.jar` in a folder that will stay.
2. In an elevated Command Prompt in that folder, start the CrushClient prompt:

   ```
   java -jar CrushTunnel.jar
   ```

3. Install the service with the server's protocol, host and port, and the login:

   ```
   service tunnel https www.crushftp.com 443 demo demo
   quit
   ```

The service starts at once and with every start of Windows. Check it in the **Services** console.

To remove it:

```
java -jar CrushTunnel.jar
service remove tunnel
quit
```

To run several tunnels on one machine, each from its own folder, add `_` and a name: `service tunnel_-Europe …` and `service remove tunnel_-Europe`.

## Linux and macOS

Start the tunnel from your own systemd unit, launchd job or init script with the one-line form:

```
java -cp CrushTunnel.jar com.crushftp.tunnel2.Tunnel2 protocol=https host=www.crushftp.com port=443 username=demo password=demo
```

A systemd unit, for example:

```
[Unit]
Description=CrushTunnel to www.crushftp.com
After=network-online.target

[Service]
WorkingDirectory=/opt/crushtunnel
ExecStart=/usr/bin/java -cp CrushTunnel.jar com.crushftp.tunnel2.Tunnel2 protocol=https host=www.crushftp.com port=443 username=demo password=demo
Restart=always
User=crushtunnel

[Install]
WantedBy=multi-user.target
```

## The login

The command line carries the password, so:

- use a CrushMFT user made only for this tunnel, with the tunnel and nothing else;
- keep the service's files and unit readable only by administrators.

## With the app instead

On a desktop that someone logs in to, the app does the same with two ticks: **Start with Login** in the tray menu, and **Connect when CrushTunnel starts** with a saved password in its window ([Connecting](Connecting.md)).
