---
title: luna login
description: Log this machine in to your Luna account by approving it in your browser.
related:
  - /concepts/keys-and-tokens
  - /cli/logout
  - /cli/whoami
---

`luna login` opens an approval page in your browser, waits while you approve this machine there, and saves the login.

```bash
luna login
```

## Reference

```bash
luna login [OPTIONS]
```

| Option | Type | Default | Does |
| --- | --- | --- | --- |
| `--no-browser` | flag | Off | Prints the address to open and leaves the browser alone. |

## Good to know

- The command prints a code. Check that the page in your browser shows the same code, then approve it there. Your password is typed in the browser and never passes through the CLI.
- The code expires after 10 minutes. Run `luna login` again to get a new one. A login denied in the browser ends the command with an error.
- On a machine with no screen, the command prints the address for you to open elsewhere. Setting `LUNA_NO_BROWSER` to anything but `0` does the same as `--no-browser`.
- The login is an account key that can read and change everything your role allows. Its name is `CLI:` and this machine's name, and `luna tokens list --account` shows it. It is saved in `~/.luna/credentials.json`, which only your user can read.
- Logging in again as the same person keeps the organisation that `luna orgs use` chose.
- A command that finds no login stops with exit code 3. Run `luna login`, or set `LUNA_TOKEN` to an API token.

## Examples

### Log in on a remote machine

```bash
luna login --no-browser
```

### Check who this machine is logged in as

```bash
luna whoami
```
