Open main menu

CDOT Wiki β

Changes

OPS235 Lab 7 - CentOS7 - HD2

36 bytes added, 16:08, 24 October 2016
no edit summary
# Edit the file '''/etc/ssh/sshd_config''' and look for the option <b><code><span style="color:#3366CC;font-size:1.2em;">PermitRootLogin</span></code></b>. <u>'''Un-comment the option'''</u> (or add the option if it does not appear) and change the option value to <b><code><span style="color:#3366CC;font-size:1.2em;">no</span></code></b>.<br><br>'''NOTE:''' Now any hacking attempt also has to guess an account name as well as the password. If you need to ssh with root access, ssh as a regular user and use '''su -''' to become root.<br><br>
# Even better, it is possible to restrict access to just specific users that require it:<br>Edit the file '''/etc/ssh/sshd_config''' and add a new option of <b><code><span style="color:#3366CC;font-size:1.2em;">AllowUsers account</span></code></b> using '''your''' login account for account<br>
# In order for these changes to be effectivetake affect, issue you need to restart the sshd daemon. Issue the following command to restart the '''sshd''' service:<br /><b><code><span style="color:#3366CC;font-size:1.2em;">systemctl restart sshd</span></code></b>
# Try sshing from your '''c7host''' VM to your '''centos1''' VM. Where you successful? Would it work if you let "AllowUsers account" without a username, or a non-existent username? Do not do this for your machine!
# Next change the default port number that sshd uses (TCP:22).
13,420
edits