Sometimes people try to hack into your computer from the internet. People (even foreign governments) scan every ip address looking for computers listening on known ports such as 21, 22, and 80. From my experience, it takes about ten minutes on the internet before somebody starts to try to hack into your pi. They try to log in with many different common passwords and sometimes crash the service. I recommend changing ports 21 and 22 to something else.

Edit the /etc/ssh/sshd_config file, and change the line with 'Port 22' to 'Port 2022' (or add that line if it's not there)
While you're there, make sure that 'PermitRootLogin' is set to 'no'
reload the sshd config (/etc/init.d/ssh reload), and you should be able to log in on port 2022 from now on.

Changing the ports to different numbers means someone would have to do a port scan to find the open ports. Configure your router to block and detect port scans. But I dont know how to turn off the [government back door][1] in your router.

I don't have instructions on how to change port 21 because I use ftp over ssh.

  [1]: http://www.infoworld.com/article/2608141/internet-privacy/snowden--the-nsa-planted-backdoors-in-cisco-products.html