06.OS/Linux
[Linux]Rocky Linux 설치 후 기본 셋팅 (Hostname,방화벽...) 변경
basicinfo119
2024. 11. 12. 11:29
728x90
반응형
Rocky 리눅스 호스트 네임 변경 방법
현재 Hostname 정보를 확인 합니다.
hostnamectl
[root@localhost.localdomain:/root]$ hostnamectl
Static hostname: (unset)
Transient hostname: localhost
Icon name: computer-desktop
Chassis: desktop 🖥️
Machine ID: 3e35814fabc440c3b52a0d066c4cb597
Boot ID: 3cbdfef1a6dc4dbfb22d2356fd23fce8
Operating System: Rocky Linux 9.4 (Blue Onyx)
CPE OS Name: cpe:/o:rocky:rocky:9::baseos
Kernel: Linux 5.14.0-427.13.1.el9_4.x86_64
Architecture: x86-64
Hardware Vendor: Gigabyte Technology Co., Ltd.
Hardware Model: B360M-D3H
Firmware Version: F11
[root@localhost.localdomain:/root]$
Static hostname: (unset)
Transient hostname: localhost
Icon name: computer-desktop
Chassis: desktop 🖥️
Machine ID: 3e35814fabc440c3b52a0d066c4cb597
Boot ID: 3cbdfef1a6dc4dbfb22d2356fd23fce8
Operating System: Rocky Linux 9.4 (Blue Onyx)
CPE OS Name: cpe:/o:rocky:rocky:9::baseos
Kernel: Linux 5.14.0-427.13.1.el9_4.x86_64
Architecture: x86-64
Hardware Vendor: Gigabyte Technology Co., Ltd.
Hardware Model: B360M-D3H
Firmware Version: F11
[root@localhost.localdomain:/root]$
변경할 Hostname 을 설정 합니다.
# hostname [변경할 hostname]
hostname rocky9
Hostname 영구적으로 변경
# hostnamectl set-hostname [new-hostname]
hostnamectl set-hostname rocky9.4
/etc/hostname 변경
[root@rocky9.4:/root]$ vi /etc/hostname
rocky9.4
rocky9.4
Rocky 리눅스 방화벽 해제
#방화벽 중지
systemctl stop firewalld.service
#방화벽 영구 비활성화
systemctl disable firewalld.service
#방화벽 상태 확인
status firewalld
#방화벽 활성화
#systemctl start firewalld.service
[root@rocky9.4:/root]$ systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
Nov 05 09:33:36 localhost systemd[1]: Starting firewalld - dynamic firewall daemon...
Nov 05 09:33:36 localhost systemd[1]: Started firewalld - dynamic firewall daemon.
Nov 06 19:27:56 rocky9.4 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Nov 06 19:27:56 rocky9.4 systemd[1]: firewalld.service: Deactivated successfully.
Nov 06 19:27:56 rocky9.4 systemd[1]: Stopped firewalld - dynamic firewall daemon.
○ firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
Nov 05 09:33:36 localhost systemd[1]: Starting firewalld - dynamic firewall daemon...
Nov 05 09:33:36 localhost systemd[1]: Started firewalld - dynamic firewall daemon.
Nov 06 19:27:56 rocky9.4 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Nov 06 19:27:56 rocky9.4 systemd[1]: firewalld.service: Deactivated successfully.
Nov 06 19:27:56 rocky9.4 systemd[1]: Stopped firewalld - dynamic firewall daemon.
SSH Root 로그인하는 접속허용방법
- Rocky 리눅스에서는 ssh 접속시 기본적으로 ROOT 접속을 허용 하지 않는다.
- root 로 ssh 접속하기 위해서는 아래의 수정 사항이 필요하다.
- /etc/ssh/sshd_config 파일을 수정 하여 PermitRootLogin yes 를 추가한다.
- 이후 ssh 를 재시작 한다.
#vi /etc/ssh/sshd_config
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes
#ssh 데몬 재시작
systemctl restart sshd
728x90
반응형