<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [hasRootAccess](./bitburner.ns.hasrootaccess.md)

## NS.hasRootAccess() method

Check if you have root access on a server.

**Signature:**

```typescript
hasRootAccess(host?: string): boolean;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

host


</td><td>

string


</td><td>

_(Optional)_ Hostname/IP of the target server. Optional. Defaults to current server if not provided.


</td></tr>
</tbody></table>

**Returns:**

boolean

True if player has root access to the specified target server, and false otherwise.

## Remarks

RAM cost: 0.05 GB

Returns a boolean indicating whether or not the player has root access to the specified target server.

## Example


```js
if (!ns.hasRootAccess("foodnstuff")) {
  ns.nuke("foodnstuff");
}
```

