Linux post-installation sshd configuration and firewall port configuration

Source: Internet
Author: User

First, the root permission vi/etc/ssh/sshd_config modify the SSH configuration

Port 8833 * Note that changes will not take effect after the change, modify the Iptables firewall port number has been otherwise cause the port number is blocked and cannot telnet *
Protocol 2
Serverkeybits 1024
Syslogfacility Authpriv
LogLevel INFO
Strictmodes Yes
Maxauthtries 3
#MaxSessions 10

Rsaauthentication No
Pubkeyauthentication Yes
Authorizedkeysfile. Ssh/authorized_keys
Permitemptypasswords No
Challengeresponseauthentication No
Gssapiauthentication No
Gssapicleanupcredentials Yes

#-!remmber Config!-------------------------
#no Safe-------* Before establishing a new user, enable no safe to set up a new user, then close no safe to enable the following safe items *
#PasswordAuthentication Yes
#UsePAM Yes
#--------------
#safe----------
Passwordauthentication No
Usepam No
Permitrootlogin No
#--------------
#------------------------------------------

Acceptenv LANG lc_ctype lc_numeric lc_time lc_collate lc_monetary lc_messages
Acceptenv lc_paper lc_name lc_address lc_telephone lc_measurement
Acceptenv lc_identification Lc_all LANGUAGE
Acceptenv xmodifiers

x11forwarding Yes
PRINTMOTD Yes
Printlastlog No
KeepAlive Yes
Useprivilegeseparation Yes
#PermitUserEnvironment No
Compression Yes
Usedns No
#PidFile/var/run/sshd.pid
Maxstartups 5
#ChrootDirectory None

#Banner None

# Override default of No subsystems
#Subsystem Sftp/usr/libexec/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User Anoncvs
# x11forwarding No
# allowtcpforwarding No
# forcecommand CVS Server

: Wq Save Exit

Second, modify the firewall iptables port

Vi/etc/sysconfig/iptales

#-a input-m State--state new-m tcp-p TCP--dport 22-j ACCEPT * Unregister original 22 Port *
-A input-m state--state new-m tcp-p TCP--dport 8833-j ACCEPT * New and enable 8833 ports enabled *

#复制原22端口行再粘贴到下一行方法 Press the ECS key into command mode to move the cursor to the line that needs to be copied "Nyy" key to copy the current line and press "P" key to paste #

: Wq Save Exit

Third, restart the SSH and iptables services

/etc/init.d/sshd_config restart

/etc/init.d/iptables restart

Linux post-installation sshd configuration and firewall port configuration

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.