---
# System prepended metadata

title: ssh-server
tags: [bash]

---

---

tags: bash
title: ssh-server
---


# Setting up ssh server

1. get needed software
```
sudo apt-get update
sudo apt-get install openssh-server
sudo apt-get install net-tools
```

2. check status of ssh server
`sudo systemctl status sshd`

3. allow access
```
sudo ufw allow ssh
sudo ufw status
```

4. enable ssh
```sudo systemctl enable ssh```

5. set port and permission in /etc/ssh/sshd_config
```
Port 2222
PermitRootLogin no
```

6. restart and check status
```
sudo systemctl restart sshd
sudo systemctl status sshd
```

7. get IP
```sudo ifconfig```

8. connect from other computer
```ssh -p 2222 <user>@<ip>```

9. when done, deactivate ssh server and check
```
sudo systemctl stop sshd
sudo systemctl status sshd
```