Framework2020. 4. 6. 18:06

Spring boot 에서 tomcat Port 변경 하기

/src/main/resources

application.properties 파일에다 

server.port = 8085

설정 하면 끝...

application.properties 파일 설정을 더 알고 싶다면.

https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html

Posted by 비니미니파
Server(Windows&Linux)2018. 6. 21. 10:51

ssh 기본 포트 22 번을 사용할 경우 외부에서 접속 시도를 무지 많이 한다.

기본 포트만 변경 해도 이런 시도를 차단 할 수 있으니 서버가 외부에 연결 되어있을 경우 무조건 하자!

ssh 기본 포트 22 번을 변경해 보자.

1. 먼저 방화벽에 변경될 포트를 설정 하자.

예제는 9999 번 포트이다. 사용할 포트를 해제하자.

~]# firewall-cmd --permanent --zone=public --add-port=9999/tcp

~]# firewall-cmd --reload

2. ssh 환결 설정을 하자

기본 환경파일은 /etc/ssh 에 있다.
#Port 22  를 복사 해서 수정 하자. ( 복사 해서 수정 하면 기본 설정값을 알 수 있다. )

 

 ~]# vi sshd_config
 #Port 22
 Port 9999

 

** 중요 추가 설정 **
ssh 로 root 접속을 차단 하자. 이것도 복사해서 수정 하자.

 

 # PermitRootLogin yes
 PermitRootLogin no

 

 

3. 서비스를 재구동 하자.

  ~]# systemctl restart sshd

 *** 오류가 난다. ***

  Job for ssh.service failed because the control process exited with error code. See "systemctl status ssh.service" and "journalctl -xe" for details.

** 중요 ** selinux 를 사용할 경우 포트 변경을 해줘야 한다.

 ~]# semanage port -a -t ssh_port_t -p tcp 9999

* semanage 는 SELinux Policy Management tool 이다.

다시 서비스를 재구동 해보자

  ~]# systemctl restart sshd

다행이다 잘 된다.

 



 


 

Posted by 비니미니파