Skip to content

Instantly share code, notes, and snippets.

@ntheanh201
Last active July 5, 2024 10:07
Show Gist options
  • Save ntheanh201/b200d56c23d749cb18c80cfaa173e1d1 to your computer and use it in GitHub Desktop.
Save ntheanh201/b200d56c23d749cb18c80cfaa173e1d1 to your computer and use it in GitHub Desktop.
yum provides /usr/sbin/semanage
# CentOS 7
yum install -y policycoreutils-python-2.5-34.el7.x86_64
# CentOS/Rocky Linux 8
yum install -y policycoreutils-python-utils
semanage port -l | grep 9091
sudo semanage port -a -t ssh_port_t -p tcp 9091
vim /etc/ssh/sshd_config
# update Port to 9091
systemctl restart sshd
journalctl -u sshd
Change hostname permanent GCP:
rm -rf /etc/dhcp/dhclient.d/google_hostname.sh
#!/bin/bash
sudo yum provides /usr/sbin/semanage
sudo yum install -y policycoreutils-python-2.5-34.el7.x86_64
sudo semanage port -a -t ssh_port_t -p tcp 9091
sudo sed -i 's/#Port 22/Port 9091/' /etc/ssh/sshd_config
sudo systemctl restart sshd
sudo journalctl -u sshd
@ntheanh201
Copy link
Author

#!/bin/bash

sudo yum provides /usr/sbin/semanage

sudo yum install -y policycoreutils-python-utils

sudo semanage port -a -t ssh_port_t -p tcp 9091

sudo sed -i 's/#Port 22/Port 9091/' /etc/ssh/sshd_config

sudo systemctl restart sshd

sudo journalctl -u sshd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment