### Bug description

Observed with Quarto 1.3.217, but due to randomness I haven't reproduced it on any other version.

Using Ubuntu 20, Firefox 110.0, Chrome 110.0.05481.100

On any project, running `quarto preview` may very rarely result in a failure to display the page in the browser due to random selection of port `5060` or `5061`. When opening `localhost:5061`, Chrome throws `ERR_UNSAFE_PORT` and Firefox throws `This address is restricted. This address uses a network port which is normally used for purposes other than Web browsing. Firefox has canceled the request for your protection.`

The error messages can be reproduced without using `quarto` by trying to open `localhost:5060` or `localhost:5061` on Chrome or Firefox. They won't even try to make a connection, so it doesn't matter if no server is running.

There may be other "restricted" or "unsafe" ports, but I don't know what they are.

The workaround is very simple: CTRL+C and re-run `quarto preview`.

### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
cscheid
2023-02-23T19:47:32Z
MattF-NSIDC
bug
v1.3
closed
`quarto preview` can rarely run on restricted/unsafe ports 5060 and 5061, Firefox/Chrome refuse to connect
https://github.com/quarto-dev/quarto-cli/issues/4514