CentOS Remote Management security settings

Source: Internet
Author: User
Tags ssh access

1. Modify SSH remote default port 22

Assuming that the remote port is to be modified to 10022, modify the following two configuration files
# Vim/etc/ssh/ssh_config
# Vim/etc/ssh/sshd_config
Find #port 22, add Port 10022 below
Then restart the sshd
# Service Sshd Restart

2. Disable root login via SSH
# Vim/etc/ssh/sshd_config
Find Permitrootlogin, change the following yes to No, the previous comment # is canceled, so root cannot log in remotely!
You can log in with a regular account and use the command SU root to switch to the root account when using root

3. Restrict SSH access to users

Suppose we just root,user1 and user2 users can use the system via SSH to add to the Sshd_config configuration file
# Vim/etc/ssh/sshd_config
Allowusers Root user1 User2

4. Configure idle time-out interval
Users can log on to the server via SSH, and you can set an idle time-out interval.
Open the Sshd_config configuration file, set as follows.
# Vim/etc/ssh/sshd_config
Clientaliveinterval 600
Clientalivecountmax 0
The above example sets an idle time-out interval of 600 seconds, or 10 minutes,
After this time, the idle user will be kicked out automatically (can be understood as exit login/Logoff).

5. Limit only one IP to telnet to the server
Vim/etc/hosts.deny #在其中加入sshd: All
Vim/etc/hosts.allow #在其中进行如下设置: sshd: # (only allow this IP telnet server)
Last restart SSH service:/etc/init.d/sshd restart

Modify a normal user with root privileges

1) Enter Super User mode. That is, enter "Su-", the system will let you enter the super user password, enter the password and enter the Super User mode. (Of course, you can also use root directly)
2) Add Write permission to the file. That is, enter the command "chmod u+w/etc/sudoers".
3) Edit the/etc/sudoers file. That is, enter the command "Vim/etc/sudoers", enter "I" into the editing mode, find this line: "Root all= (All) all" in the following add "XXX all= (All) all" (Here xxx is your user name), Then save (just press the ESC key and enter ": Wq") to exit.
4) Revoke the Write permission of the file. This is the input command "chmod u-w/etc/sudoers".

This article is from the "lake and Laughter" blog, please make sure to keep this source http://hashlinux.blog.51cto.com/9647696/1788393

CentOS Remote Management security settings

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.