Lunarpages Web Hosting Forum

Author Topic: Secure the Secure Shell (SSH)  (Read 12283 times)

Offline PeterM

  • Spacescooter Operator
  • *****
  • Posts: 36
Secure the Secure Shell (SSH)
« on: May 08, 2005, 11:27:58 PM »
By default SSH will give root and any local user secure access to the server. For security reasons it is a good idea to change this setting and specify the users which are allowed to have SSH access. The configuration file for SSH is called sshd_config and is either in /etc or      /etc/ssh

Login to the server and on the command prompt do:

[root@office root]# vi /etc/ssh/sshd_config

things to change:

#don't allow root to SSH in to the server:
PermitRootLogin no

#users allowed to login:
AllowUsers user1 user2 user3

Now do a "shift zz" (hold down the shift key and tab 2 times the z key)
The configuration file now is saved and closed and you have to restart ssh:
[root@office root]# /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                              [  OK  ]
[root@office root]#
Now you can SSH to your server with your username,then do a su on the command prompt and type in the root password to become root.


  • Guest
Re: Secure the Secure Shell (SSH)
« Reply #1 on: July 08, 2007, 10:20:46 PM »
Also you can secure your ssh changing default port(22)
Change the port that SSH listens for connections on:

      #Port 22
      Port XX    (where XX = your new portnumber)
You can choose something like 22202 or something you can remember

  You are now done editing the /etc/ssh/sshd_config file (save your changes, and quit your editor).
Another important thing dont forgot to allow the port you choose from firewall:
and you add there your new ssh port
I hope this help
Thank you