이전 글목록 보기다음 글
linux2026-09-14T04:54:25.872Z

reclone으로 Goole Drive 연결하기

Anya2_Forger profileAnya2_Forger
edited-images.png

1. rclone이 무엇인가?

rclone은 Linux 서버와 Google Drive 같은 클라우드 저장소 사이에서 파일을 복사할 수 있게 해주는 프로그램입니다.

구조는 간단합니다.

Ubuntu 서버
    │
    │ rclone
    ▼
Google Drive

예를 들어:

rclone copy /home/user/backup repo:backup/

라고 하면

/home/user/backup
       │
       │ rclone
       ▼
Google Drive
└── backup/

으로 파일을 복사합니다.

rclone 자체는 무료 오픈소스 프로그램입니다.


2. rclone 설치 확인

먼저 서버에서:

rclone --version

현재 사용하신 서버에서는:

rclone v1.60.1-DEV
os/version: ubuntu 26.04
os/arch: amd64

처럼 나왔습니다.

정상적으로 설치되어 있다면 다음 단계로 넘어갑니다.


3. Google Drive 연결 시작

다음 명령을 실행합니다.

rclone config

처음 실행하면:

No remotes found, make a new one?

n) New remote
s) Set configuration password
q) Quit config

n/s/q>

여기서:

n

을 입력합니다.

즉:

n/s/q> n

nNew remote, 새로운 연결을 만든다는 뜻입니다.


4. Remote 이름 지정

다음이 나옵니다.

Enter name for new remote.
name>

여기에는 원하는 이름을 넣습니다.

예를 들어:

name> repo

저는 지금부터 repo라는 이름을 사용하겠습니다.

나중에 Google Drive를 사용할 때:

rclone lsd repo:

처럼 사용하게 됩니다.

중요: rclone에서 repo::가 중요합니다.
reporepo:는 다릅니다.


5. Storage 선택

다음 화면이 나옵니다.

Option Storage.
Type of storage to configure.

...
24 / Google Drive
   \ (drive)
...
Storage>

여기서:

24

를 선택합니다.

또는 버전에 따라 번호가 달라질 수 있으므로 Google Drive라고 표시된 항목의 번호를 선택하면 됩니다.

현재 사용하신 버전에서는:

Storage> 24

였습니다.


6. Google Application Client ID

다음:

Option client_id.
Google Application Client Id

Leave blank to use rclone's shared client_id...

client_id>

여기서는 직접 만든 Google OAuth Client ID를 사용하는 것을 권장합니다.

현재 사용하신 방식에서는 Google Cloud에서 OAuth 클라이언트를 만들어 다음과 같은 값을 얻었습니다.

38483284-xxxxxxxxxxxxxxxx.apps.googleusercontent.com

따라서:

client_id> 38483284-xxxxxxxxxxxxxxxx.apps.googleusercontent.com

을 입력합니다.

rclone의 공식 문서도 현재 공유 client ID가 2026년에 폐기될 예정이므로 자신의 client ID를 만드는 것을 권장하고 있습니다. (Rclone)


7. Google Application Client Secret

다음:

Option client_secret.
Google Application Client Secret

client_secret>

Google Cloud에서 만든 OAuth 클라이언트의 Client Secret을 입력합니다.

형식은 대략:

GOCSPX-xxxxxxxxxxxxxxxx

입니다.

client_secret> GOCSPX-xxxxxxxxxxxxxxxx

8. Scope 선택

다음 화면:

Option scope.
Comma separated list of scopes...

1 / Full access all files, excluding Application Data Folder.
  \ (drive)

2 / Read-only access to file metadata and file contents.
  \ (drive.readonly)

3 / Access to files created by rclone only.
  \ (drive.file)

4 / Allows read and write access to the Application Data folder.
  \ (drive.appfolder)

5 / Allows read-only access to file metadata...
  \ (drive.metadata.readonly)

scope>

여기서는:

1

을 선택했습니다.

즉:

scope> 1

왜 1번인가?

drive는 Google Drive에 대한 전체적인 읽기/쓰기 권한입니다.

우리는 나중에 서버에서:

rclone copy ...

로 파일을 Google Drive에 업로드할 것이므로 1번이 편합니다.

rclone 공식 문서에서도 drive scope는 전체 파일에 대한 접근을 허용하며, 확실하지 않으면 이 옵션을 선택하도록 설명하고 있습니다. (Rclone)


9. Service Account

다음:

Option service_account_file.

Service Account Credentials JSON file path.

Leave blank normally.

service_account_file>

여기서는 그냥 Enter를 누릅니다.

service_account_file>

즉 아무것도 입력하지 않습니다.

우리는 Service Account 방식이 아니라 일반 Google 계정 OAuth 인증 방식을 사용할 것이기 때문입니다.


10. Advanced config

다음:

Edit advanced config?

y) Yes
n) No (default)

y/n>

여기서는:

n

입니다.

y/n> n

대부분의 일반적인 Google Drive 사용에는 고급 설정이 필요하지 않습니다.


11. Shared client ID 사용 여부

rclone 버전에 따라 다음과 같은 질문이 나올 수 있습니다.

rclone's shared Google Drive client_id is being retired during 2026.

Continue using the shared client_id anyway?

y) Yes
n) No (default)

y/n>

우리는 직접 만든 Client ID를 이미 입력했기 때문에 이 화면이 나오더라도:

n

을 선택합니다.

y/n> n

그러면 다시:

Option client_id.
Google Application Client Id

client_id>

가 나오고, 자신이 만든 Client ID를 입력합니다.


12. 서버에 브라우저가 있는가?

여기가 이번 설정에서 가장 중요한 부분입니다.

다음과 같은 질문이 나옵니다.

Use web browser to automatically authenticate rclone with remote?

* Say Y if the machine running rclone has a web browser you can use
* Say N if running on a (remote) machine without web browser access

y) Yes (default)
n) No

y/n>

현재 서버 unionynj서버이므로 브라우저가 없습니다.

따라서:

n

입니다.

y/n> n

rclone 공식 문서에서도 브라우저가 없는 remote/headless 서버에서는 N을 선택하고, 브라우저가 있는 다른 컴퓨터에서 rclone authorize를 실행하도록 안내합니다. (Rclone)


13. config_token

그러면 서버에서:

Option config_token.

For this to work, you will need rclone available on a machine
that has a web browser available.

Execute the following on the machine with the web browser:

rclone authorize "drive" "..."

Then paste the result.

Enter a value.

config_token>

가 나옵니다.

여기서 서버는 그대로 기다리게 둡니다.

config_token>

14. PC lap79에서 rclone authorize

이제 Google 인증을 할 수 있는 PC로 갑니다.

현재 사용자의 경우:

lap79

입니다.

PC에 rclone이 설치되어 있어야 합니다.

확인:

rclone --version

그 다음 서버가 알려준 명령을 실행합니다.

예:

rclone authorize "drive" "..."

그러면:

NOTICE: Make sure your Redirect URL is set to
"http://127.0.0.1:53682/" in your custom config.

NOTICE: If your browser doesn't open automatically go to the following link:

http://127.0.0.1:53682/auth?state=...

NOTICE: Log in and authorize rclone for access

NOTICE: Waiting for code...

가 나옵니다.


15. Google Cloud의 Redirect URI

이번 과정에서 이 부분 때문에 처음에 오류가 발생했습니다.

Google Cloud의 OAuth Client가 Web application인 경우:

승인된 리디렉션 URI

에 다음을 등록해야 합니다.

http://127.0.0.1:53682/

주의할 점:

127.0.0.1

을 사용하고,

localhost

와 혼동하지 않는 것이 좋습니다.

rclone이 실제 실행 시 다음 주소를 사용한다고 알려주기 때문입니다.

http://127.0.0.1:53682/

rclone은 이 로컬 주소에서 일시적으로 인증용 웹 서버를 실행합니다. (Rclone)


16. PC에서 Google 로그인

PC 브라우저에서 rclone 인증 페이지가 열립니다.

Google 계정으로 로그인합니다.

그리고 Google Drive 접근을 허용합니다.

성공하면:

Success!

All done. Please go back to rclone.

같은 화면이 나옵니다.


17. PC 터미널의 인증 토큰

PC 터미널에는 인증이 완료되면서 토큰이 출력됩니다.

대략:

Paste the following into your remote machine --->

{ ... }

<---End paste

토큰 전체를 복사합니다.

⚠️ 이 토큰은 비밀번호와 같은 민감정보입니다.

채팅이나 다른 사람에게 공개하면 안 됩니다.


18. 서버의 config_token에 붙여넣기

다시 unionynj 서버로 돌아옵니다.

아까 기다리고 있던:

config_token>

에 PC에서 복사한 토큰을 붙여넣습니다.

config_token> [복사한 토큰]

그러면 rclone이 Google Drive 인증정보를 서버에 저장합니다.

이 방식이 바로 PC에서 인증하고 서버에 인증 결과를 전달하는 방식입니다. (Rclone)


19. Shared Drive 여부

다음 질문이 나옵니다.

Configure this as a Shared Drive (Team Drive)?

y) Yes
n) No (default)

y/n>

개인 Google Drive라면:

n

입니다.

y/n> n

회사/조직에서 사용하는 Google Shared Drive라면 y입니다.

현재 사용자의 경우 일반 Google Drive이므로:

n

을 선택했습니다.


20. Configuration complete

정상적으로 진행되면:

Configuration complete.

Options:
- type: drive
- scope: drive
- client_id: ...
- client_secret: ...
- token: ...
- team_drive:

그리고:

Keep this "repo" remote?

y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote

y/e/d>

가 나옵니다.

여기서는:

y

입니다.

y/e/d> y

그러면 Google Drive remote 설정이 저장됩니다.


21. rclone config 종료

다시:

Current remotes:

Name       Type
====       ====
repo    drive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config

e/n/d/r/c/s/q>

여기서:

q

를 입력합니다.

e/n/d/r/c/s/q> q

22. Google Drive 연결 테스트

이제 가장 먼저 다음을 실행합니다.

rclone lsd repo:

여기서 매우 중요한 점

다음은 잘못된 명령입니다.

rclone lsd repo

rclone은 이것을 Google Drive remote가 아니라 **로컬 디렉터리 repo**로 해석할 수 있습니다.

실제로 사용자가 실행했을 때:

NOTICE: "repo" refers to a local folder
ERROR : error listing: directory not found

가 발생했습니다.

올바른 명령은:

rclone lsd repo:

입니다.

:Google Drive remote라는 것을 나타냅니다.

rclone 공식 문서에서도 Drive 경로를 remote:path 형태로 사용합니다. (Rclone)


23. Google Drive 용량 확인

다음 명령도 실행해 봅니다.

rclone about repo:

사용자의 실제 결과는:

Total:   30 GiB
Used:    0 B
Free:    29.989 GiB
Trashed: 0 B
Other:   11.226 MiB

였습니다.

이 결과가 나온다면 Google Drive에 정상적으로 연결된 것입니다.


24. 실제 파일 업로드 테스트

마지막으로 실제 업로드까지 테스트하는 것이 좋습니다.

먼저 테스트 파일을 만듭니다.

echo "rclone test" > ~/rclone-test.txt

Google Drive에 폴더를 하나 만들고:

rclone mkdir repo:rclone-test

파일을 업로드합니다.

rclone copy ~/rclone-test.txt repo:rclone-test/

그리고 확인합니다.

rclone ls repo:rclone-test/

다음처럼 나오면 성공입니다.

13 rclone-test.txt

즉 최종적으로:

Ubuntu 서버
    │
    │ rclone
    ▼
Google Drive
    │
    └── rclone-test/
          └── rclone-test.txt

가 만들어진 것입니다.


25. 전체 과정을 아주 짧게 요약

실제 작업 순서는 다음과 같습니다.

① rclone 설치
       ↓
② rclone config
       ↓
③ New remote
       ↓
④ Google Drive 선택
       ↓
⑤ Client ID 입력
       ↓
⑥ Client Secret 입력
       ↓
⑦ Scope = 1 (drive)
       ↓
⑧ Service Account = Enter
       ↓
⑨ Advanced config = n
       ↓
⑩ Shared client ID 사용 = n
       ↓
⑪ 서버에 브라우저 없음 = n
       ↓
⑫ config_token>
       ↓
⑬ PC(lap79)에서 rclone authorize "drive" ...
       ↓
⑭ Google 로그인
       ↓
⑮ 인증 토큰 복사
       ↓
⑯ 서버 config_token>에 붙여넣기
       ↓
⑰ Shared Drive = n
       ↓
⑱ Keep remote = y
       ↓
⑲ q
       ↓
⑳ rclone lsd repo:
       ↓
㉑ rclone about repo:
       ↓
㉒ 실제 파일 업로드 테스트

최종적으로 기억할 명령 4개

앞으로 Google Drive를 사용할 때는 이것만 기억하셔도 상당 부분 충분합니다.

# Google Drive 폴더 보기
rclone lsd repo:

# Google Drive 용량 보기
rclone about repo:

# 파일 업로드
rclone copy /home/user/파일 repo:backup/

# Google Drive 파일 보기
rclone ls repo:backup/

핵심은 repo:처럼 remote 이름 뒤에 :을 붙이는 것입니다.

.

최종 목적이 **"서버의 특정 Git 폴더를 매일 새벽 특정 시간에 Google Drive에 자동 업로드"**하는 것이므로, 이 다음에는 rclone copycron을 연결하면 것입니다.

.

rclone 공식 문서에서도 로컬 디렉터리를 Drive의 특정 디렉터리로 rclone copy하는 방식을 안내하고 있습니다. (Rclone)

Comments

Log in to comment

Loading comments...
이전 글목록 보기다음 글

당신의 이야기를 기다리고 있습니다