# downgrade-root

> Try to downgrade the permissions of a process with root privileges

Latest version **2.0.0** (published 2021-05-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install downgrade-root
pnpm add downgrade-root
yarn add downgrade-root
bun add downgrade-root
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-05-03 |
| First published | 2015-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 2 |
| Unpacked size | 3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus, silverwind |
| Keywords | sudo, root, user, permissions, uid, block, prevent, stop, downgrade, drop, privileges |

## Links

- npm: https://www.npmjs.com/package/downgrade-root
- Repository: https://github.com/sindresorhus/downgrade-root
- Homepage: https://github.com/sindresorhus/downgrade-root#readme
- Issues: https://github.com/sindresorhus/downgrade-root/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/downgrade-root

## Dependencies (2)

- [is-root](https://npm.io/package/is-root.md) ^3.0.0
- [default-uid](https://npm.io/package/default-uid.md) ^2.0.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2021-05-03
- 1.2.2 — 2016-06-15
- 1.1.0 — 2015-01-07
- 1.0.0 — 2015-01-07

## README

# downgrade-root

> Try to downgrade the permissions of a process with root privileges

Usually applies to a process started with `sudo`.

Windows is gracefully ignored as it lacks a way to [set UID](http://nodejs.org/api/process.html#process_process_setuid_id).

## Install

```
$ npm install downgrade-root
```

## Usage

```js
import downgradeRoot from 'downgrade-root';

try {
	downgradeRoot();
} catch {
	console.error('Couldn\'t downgrade permissions');
}
```

## Tip

Useful for [trying to downgrade permission](https://github.com/sindresorhus/root-check) before [blocking](https://github.com/sindresorhus/sudo-block) using your app as root.

---
_Source: https://npm.io/package/downgrade-root · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
