- Changing ssh port
/etc/ssh/sshd_config
Port 22
Restart ser
- Find running network services (either of the following commands)
ss -nlp
netstat -nlp
Stop services using
service <service_name> stop
Remove from startup using update-rc.d or chkconfig
- Allow your ISP subnet in firewall for ssh
Port scanning sometimes can reveal ssh ports. Using high port range for ssh, can also be a good idea.
- Overlayfs vulnerability can help unprivileged user to gain root access.
http://securitytracker.com/id/1034548
Ah! Ubuntu has issued a fix for 15.10/15.04 server. Overlayfs module is/was enabled by default(least on Ubuntu), which helps in merging mounts to existing directory of files.
Disable kernel module by adding "blacklist <module_name>" in /etc/modprobe.d/<name>.conf
- Disable root login
/etc/ssh/sshd_config
PermitRootLogin no
- Password sudo
Login in as any other user than root, and sudo to root, using password. Users have a bad habit of not keeping sudo password.
Edit /etc/sudoers using visudo
=> use PASSWD, instead of ALL/NOPASSWD. Refer manual.