遠端設定請輸入 n
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n> n
Please go to the following link: 後面的連結點一下,登入你資料來源的帳號然後在
「rclone」想要存取您的 Google 帳戶 按下 [允許]
將那一串帶登入的 key 複製下來, ctrl+v 到下面的 code>
Enter verification code>
接下來是問要不要設定 Team Drive?請輸入 n
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> n
確認資訊是否正確?預設值按輸入鍵就好
[gd01]
type = drive
scope = drive
token = {"access_token":"xxxxxx"}
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>
可以看到 gd01 已經建立完畢,我們依上面的步驟按 n 再建立 gd02
Current remotes:
Name Type
==== ====
gd01 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> n
如果 gd01 gd02 都建立完畢後,我們再按 q 離開 rclone config
Current remotes:
Name Type
==== ====
gd01 drive
gd02 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
2.gd 共用雲端硬碟td -> gd 共用雲端硬碟td
剛剛的視窗已經用於 gdtogd 我們有開 screen 所以直接把視窗關閉就可以
我們回到左上角導覽選單 -> Compute Engine -> VM 執行個體 -> 連結 -> 在瀏覽器視
窗中開啟
我們輸入
screen -ls
可以看到 gd01togd02 的多重視窗還存在,隨時可以輸入 screen -x gd01togd02 登入
There is a screen on:
10366.gd01togd02 (Attached)
1 Socket in /var/run/screen/S-dcshare.
不過這一次我們要設定 td 所以輸入
screen -S gd02tdtogd01td
一樣輸入
rclone config
e/n/d/r/c/s/q> n
name> gd01td
Storage> 15
client_id>
client_secret>
scope> 1
root_folder_id>
service_account_file>
y/n>
y/n> n
登入 gd01 帳號
Enter verification code> ctrl+v 貼上 code
Team Drive 這裡選 y
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> y
他會列出你目前所有的 Team Drive ,我們這次範例輸入 2
Fetching Shared Drive list...
Choose a number from below, or type in your own value
1 / ttest
\ "0Axxxx"
2 / test
\ "0Axxx"
Enter a Shared Drive ID> 2
y/e/d>
就能看到 gd01td 建立完成囉~
Current remotes:
Name Type
==== ====
gd01 drive
gd01td drive
gd02 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> n
我們一樣輸入 n 建立 gd02td 前面步驟都相同
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> y
Fetching Shared Drive list...
Choose a number from below, or type in your own value
1 / abc001
\ "0Axxx"
Enter a Shared Drive ID> 1
y/e/d>
就能看到 gd02td 建立完成囉~
Current remotes:
Name Type
==== ====
gd01 drive
gd01td drive
gd02 drive
gd02td 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
我們這次只要複製其中一個資料夾的話可以這樣下,目錄名稱不需要帶 Team Drive 的名
稱,因為我們已經設定到 Team Drive 資料夾內
rclone -vv copy gd02td:Music/"我愛聽的歌 第二集" gd01td:Music/"我愛聽的歌 第二
集"
放了一天來看因為 SSH 允許所有人連入,只是要使用 key 才能登入。
輸入
sudo lastb
可以看到有人嘗試透過帳密登入但是都被擋下來了。
support ssh:notty 141.98.80.85 Wed Mar 10 08:20 - 08:20 (00:00)
guest ssh:notty 141.98.80.83 Wed Mar 10 08:20 - 08:20 (00:00)
ubnt ssh:notty 141.98.80.82 Wed Mar 10 08:20 - 08:20 (00:00)
guest ssh:notty 141.98.80.71 Wed Mar 10 08:20 - 08:20 (00:00)
test ssh:notty 141.98.80.69 Wed Mar 10 08:20 - 08:20 (00:00)
admin ssh:notty 141.98.80.82 Wed Mar 10 08:20 - 08:20 (00:00)
user ssh:notty 141.98.80.71 Wed Mar 10 08:20 - 08:20 (00:00)
admin ssh:notty 141.98.80.70 Wed Mar 10 08:20 - 08:20 (00:00)
admin ssh:notty 141.98.80.69 Wed Mar 10 08:20 - 08:20 (00:00)
uploader ssh:notty c-73-208-94-123. Wed Mar 10 06:31 - 06:31 (00:00)
pi ssh:notty 93.51.127.23 Wed Mar 10 06:29 - 06:29 (00:00)
ubnt ssh:notty 195.54.160.250 Wed Mar 10 03:25 - 03:25 (00:00)
admin ssh:notty 185.220.102.4 Wed Mar 10 00:37 - 00:37 (00:00)
admin ssh:notty 209.127.17.242 Wed Mar 10 00:37 - 00:37 (00:00)
admin ssh:notty 23.129.64.210 Wed Mar 10 00:37 - 00:37 (00:00)
admin ssh:notty 185.220.101.194 Wed Mar 10 00:37 - 00:37 (00:00)
odoo ssh:notty 202.28.194.163 Wed Mar 10 00:01 - 00:01 (00:00)
ubnt ssh:notty 31.210.22.2 Tue Mar 9 20:55 - 20:55 (00:00)
testuser ssh:notty 45.93.201.193 Tue Mar 9 18:55 - 18:55 (00:00)
zyfwp ssh:notty 195.54.160.250 Tue Mar 9 15:29 - 15:29 (00:00)
輸入
last
可以看到成功登入的使用者都是我自己 與 screen
test pts/2 35.235.241.16 Wed Mar 10 10:58 still logged in
test pts/1 35.235.240.5 Wed Mar 10 07:02 - 07:57 (00:55)
test pts/1 35.235.240.2 Wed Mar 10 01:21 - 02:08 (00:46)
test pts/3 :pts/2:S.0 Tue Mar 9 15:44 - 17:29 (01:45)
test pts/0 :pts/1:S.0 Tue Mar 9 15:23 - 15:46 (00:23)
test pts/1 35.235.241.18 Tue Mar 9 14:13 - 15:46 (01:32)
test pts/0 35.235.241.19 Tue Mar 9 14:05 - 14:27 (00:22)
reboot system boot 3.10.0-1160.15.2 Tue Mar 9 14:01 - 10:58 (20:56)
接下來我們建立 gd01tdtest2
rclone config
e/n/d/r/c/s/q> n
name> gd01tdtest2
Storage> 15
client_id>
client_secret>
scope> 1
root_folder_id>
service_account_file>
y/n>
y/n> n
按連結登入 gd01 帳號 -> 允許 -> 複製 code
Enter verification code> 貼上複製的 code
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> y
Fetching Shared Drive list...
Choose a number from below, or type in your own value
1 / test
\ "0Axxx"
2 / test2
\ "0Axxx"
Enter a Shared Drive ID> 2
y/e/d>
e/n/d/r/c/s/q> q
Traceback (most recent call last):
File "gen_sa_accounts.py", line 323, in <module> download_keys=args.download
_keys
File "gen_sa_accounts.py", line 161, in serviceaccountfactory
proj_id = loads(open(credentials,'r').read())['installed']['project_id']
File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quote
s: line 1 column 2 (char 1
代表你 credentials.json 不是用上傳的方式,格式跑掉了~用這個方式傳入 sudo bash
-c "echo '[ctrl]+[v]' > credentials.json" 是不行的喔!
點一下 Please visit this URL to authorize this application: 後面的連結。
使用 Google 帳戶登入 -> 我們剛剛用 GCP 的帳號登入這裡相同 -> 允許 -> 複製授權
碼
貼到 Enter the authorization code: 裡
如果出現下列字樣
Service Usage API has not been used in project 123442485074 before or it is di
sabled. Enable it by visiting https://console.developers.google.com/apis/api/s
erviceusage.googleapis.com/overview?project=xxxxx then retry. If you enabled t
his API recently, wait a few minutes for the action to propagate to our system
s and retry.
Press Enter to retry.
請點一下他給的連結記得登入的帳號是 GCP 的帳號才看的到。