If you connect your "Raspberry Pi", running Raspbian, to the internet it will be exposed to attackers. on the internet
First
Since Raspbian comes with a preconfigured user (the "pi" user) everyone knows the username and the password to access your system. So first of all you have to change the password. Open a shell, login as pi user and issue the following command:
-$ passwd
You will be asked for a new password.
Open a shell, login as pi user and execute the following steps:
- open the /etc/sshd/sshd_config with your favourite editor
- Search for "Port 22"
- Change the previous line with a different value (you can should choose values greater than 1024) for example 11111
Port 11111
- Restart the sshd service issueing the following command:
-$ /etc/init.d/ssh restart
- Check the connection running the following command:
-$ ssh pi@127.0.0.1 -p 11111
That's all.
don't forget fail2ban too !
I had to change the port forwarding on my router too.
Steve.