First 2 things to do if you want to secure your Raspberry Pi on the internet.
If you connect your "Raspberry Pi", running Raspbian, to the internet it will be exposed to attackers. on the internet
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:
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
- Restart the sshd service issueing the following command:
-$ /etc/init.d/ssh restart
- Check the connection running the following command:
-$ ssh firstname.lastname@example.org -p 11111