New to Centos 7
1. Modify the SSH port number in Centos 7
1. Modify/etc/ssh/sshd_config
Vi/etc/ssh/sshd_config
# Port 22 Add the following line under this line
Port 7156 // Add this line below
2. Modify SELinux
Run the following command to view the ssh ports allowed by SElinux:
Install semanage,
Yum-y installpolicycoreutils-python
Semanage port-a-t ssh_port_t-p tcp 7156
Then confirm whether to add it.
Semanage port-l | grep ssh
If it is successful
Ssh_port_t tcp 7156, 22
3. Restart ssh
Systemctl restart sshd (systemctl restart sshd. service)
4. Open the ssh port in firewall
Firewall-cmd -- zone = public -- add-port = 7156/tcp -- permanent
Firewall-cmd -- reload
Firewall-cmd -- list-all-zones | grep 7156 // view the result
2. No ifconfig command. You can use yum search ifconfig to query the package.
Yum-y install net-tools
Iii. hostname storage directory
/Etc/hostname