# 분실 시 해결 방법 - Ubuntu

## 1. 싱글 유저 모드 진입

<mark style="background-color:blue;">웹콘솔 > 서버 > 가상서버 > 콘솔접속</mark>

콘솔 우측 상단의 "Send CtrlAltDel" 클릭합니다.

<div align="left"><figure><img src="/files/yKqTSDlCVkt6tYrU6aUB" alt=""><figcaption></figcaption></figure></div>

부팅 프로세스가 시작하면 5초안에 "Esc 키'"를 눌러 GRUB 부팅 프롬프트를 표시 합니다.

GRUB 부트 프롬프트에 도달하기 위해 시스템을 껐다가 다시 켜야 할 수도 있습니다.

GRUB 부팅 프롬프트가 표시되면 화살표키를 사용하여 "Advanced options for Ubuntu" 선택하여 "엔터" 를 누릅니다.

<div align="left"><figure><img src="/files/1lL7l2YABf0EEIZBkVRx" alt=""><figcaption></figcaption></figure></div>

"recovery mode"로 표시 되어있는 항목을 선택후 엔터키를 누릅니다.

<div align="left"><figure><img src="/files/bcXVoxPIJDrQXmdiYMSf" alt=""><figcaption></figcaption></figure></div>

우분투 복구 모드에서 키보드의 화살표키를 사용하여 "root Drop to root shell prompt" 선택후 엔터키를 누릅니다.

<div align="left"><figure><img src="/files/U3VtpLgglxwYIDDGihIj" alt=""><figcaption></figcaption></figure></div>

## 2. 패스워드 재설정

다음  과정을 순차적으로 실행합니다.  &#x20;

* "**mount -o remount, rw /**" 명령어로 루트 영역파일 시스템을 read, write 권한으로  마운트
* "**passwd ubuntu(계정명)**" 명령어로 ubuntu 계정의 패스워드를 설정
* "**vi /etc/ssh/sshd\_config**" 명령어로 파일을 수정

<div align="left"><figure><img src="/files/Ug0ljU1NcBldCHMS4A4K" alt=""><figcaption></figcaption></figure></div>

키페어 접속 방식에서 "/etc/ssh/sshd\_config" 파일에서 PasswordAuthentication no 를 yes로 파라미터를 업데이트합니다.\
"**reboot now**" 명령어로 서버를 재부팅합니다.

<div align="left"><figure><img src="/files/D6atNP0dj2K5o1Kl4gTb" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="/files/X6nj1B5OF6ZI7HYM3XDD" alt=""><figcaption></figcaption></figure></div>

Ubuntu 22.04의 경우, /etc/ssh/sshd\_config.d/60-cloudimg-settings.conf 파일 수정을 추가로 진행합니다.

**(PasswordAuthentication의 값을 no에서 yes)**

<figure><img src="/files/4NWchFELjRXUzlTHBc46" alt=""><figcaption></figcaption></figure>

## 3. 패스워드 접속 확인

계정으로 접속이 잘되는지 확인합니다.

<div align="left"><figure><img src="/files/AjhvJpx5LernDcusnC7K" alt=""><figcaption></figcaption></figure></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cafe24cloud.com/home/security/keypair/ubuntu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
