Dropbox

出自 Arch Linux 中文维基

本文內容或本節內容已經過期。

原因: 請提供模板的第一個位置參數以概括原因。 (在Talk:Dropbox討論)

這篇文章或章節的翻譯不反映原文。

原因:Last updated in 2014(在 Talk:Dropbox# 中討論)

Dropbox is a file sharing system that recently introduced a GNU/Linux client. Use it to transparently sync files across computers and architectures. Simply drop files into your ~/Dropbox folder, and they will automatically sync to your centralized repository.

安裝[編輯 | 編輯原始碼]

AUR[編輯 | 編輯原始碼]

您可以從 AUR 安裝 dropboxAUR

注意: 如果 PKGBUILD 已經過時,你可以在下載後更新它,或者在 AUR 頁面標記其為過期。
  1. 安裝完畢,您就可以從程序菜單中的圖標或者是在命令行中輸入 dropboxd 啟動 Dropbox。 您將會在系統托盤中看到程序的圖標。
  2. Dropbox 也許會有彈窗提示(此程序非官網下載等等),你知道這個程序是從 AUR 下載安裝的就好啦,然後你可以放心大膽的點擊「Don't ask again」來忽視這個提示。
  3. 然後會看到一個要求您輸入賬户信息的窗口,您可以輸入已有賬户或者是新建一個賬户。
  4. 再然後您會看到 Dropbox 的歡迎頁面,此處將會有一個關於如何使用 Dropbox 的簡短的介紹。
  5. 點擊 "Finish and go to My Dropbox"。

手動安裝[編輯 | 編輯原始碼]

本文或本章節的事實準確性存在爭議。

原因: 應該儘量使用 pacman 來安裝和管理軟件包,或是從 PKGBUILD 建立軟件包。(在 Talk:Dropbox 中討論)

以下的內容將介紹 從命令行下手動安裝 Dropbox。以 64 位系統為例,運行:

$ cd ~
$ wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

然後,啟動 Dropbox:

$ ~/.dropbox-dist/dropboxd

可選軟件包[編輯 | 編輯原始碼]

啟動[編輯 | 編輯原始碼]

自動啟動 Dropbox[編輯 | 編輯原始碼]

對於 KDE 用户來説,在註銷用户或者是重啟機器後,之前正在運行的程序將會自動重新啟動。Xfce 稍有不同,將 dropbox.desktop 放置在 {ic|~/.config/autostart}} 下,Dropbox 在下次啟動時就會自動啟動了。

如果這些都不能正常的工作,那您也可以將 ~/.dropbox-dist/dropboxd & 添加到 ~/.xinitrc 來讓窗口管理器控制它的啟動(也有可能在 ~/.config/openbox/autostart,看你的設置了)。當然,您也可以將 Dropbox 作為服務啟動.

作為 systemd 的服務啟動[編輯 | 編輯原始碼]

當前的 Dropbox 版本已經包含了 systemd 服務文件。默認的 systemd 服務文件並不能在系統托盤中顯示軟件的圖標,但是依舊在後台默默的為您同步您的文件。如果您需要托盤圖標支持,那麼建立 /etc/systemd/system/dropbox@.service ,修改環境變量 DISPLAY 後替換默認的 systemd 服務文件:

/etc/systemd/system/dropbox@.service
.include /usr/lib/systemd/system/dropbox@.service
[Service]
Environment=DISPLAY=:0

最後,啟動此服務,在登錄時 Dropbox 將能夠自動運行:

# systemctl enable dropbox@<user>

Note that you have to manually start Dropbox the first time after installation, so that it runs through the login and setup screen. Further, you need to uncheck the option Start Dropbox on system startup in order to prevent Dropbox from being started twice. The daemon can then be used subsequently.

Run as a daemon with systemd user[編輯 | 編輯原始碼]

If you have followed the systemd/User wiki page, you probably want to start dropbox only when you log in or launch your WM/DE. The solution in that case is to create a service in your home directory instead of using the sysadmin account:

$HOME/.config/systemd/user/dropbox@.service
[Unit]
Description=Dropbox as a systemd service
After=xorg.target

[Service]
ExecStart=/home/<user>/.dropbox-dist/dropboxd
ExecReload=/bin/kill -HUP $MAINPID
Environment=DISPLAY=%i

[Install]
WantedBy=default.target

Then you can start or enable it with:

$ systemctl --user {start|enable} dropbox@:0.service

That way you can easily start it in your main display (likely :0) or in another one, without having to hard code it.

注意: After a lot of trial and error I found that using /usr/bin/dropboxd did not start the service and it did not show any error either (even when running it directly from the terminal worked fine). I believe it has to do that starting it that way systemd does not know which user is actually running the daemon.

不安裝 Dropbox 而訪問文件[編輯 | 編輯原始碼]

如果您僅需要基本的訪問文件的功能,那麼您可以訪問 https://www.dropbox.com/ 來上傳或者是下載您的文件。此方法不需要安裝 Dropbox 。

另外,您也可以嘗試從 AUR 安裝 droxiAUR ,此終端工具提供了類似於 GNU ftp 客户端的功能。

Securing your Dropbox[編輯 | 編輯原始碼]

If you want to store sensitive data in your Dropbox, you should encrypt it before. Syncing to Dropbox is encrypted, but all files are (for the time being) stored on the server unencrypted just as you put them in your Dropbox.

  • Dropbox works with TrueCrypt, and after you initially uploaded the TrueCrypt volume to Dropbox, performance is quite okay, because Dropbox has a working binary diff.
  • Another possibility is to use EncFS, which has the advantage that all files are encrypted separately, i.e. you do not have to determine in advance the size of the content you want to encrypt and your encrypted directory grows and shrinks while you add/delete/modify files in it. You can also mount an encrypted volume at startup using the -S option of encfs to avoid having to input the passphrase, but note that your encrypted files are not secure from someone who has direct access to your computer.

Setup EncFS with Dropbox[編輯 | 編輯原始碼]

Follow the Wiki instructions to install EncFS.

Assuming you have set your Dropbox directory as ~/Dropbox:

Create a folder. Files you want synced to Dropbox will go in here.

$ mkdir ~/Private

Run the following and enter a password when asked:

$ encfs ~/Dropbox/Encrypted ~/Private

Your secure folder is ready for use; creating any file inside ~/Private will automatically encrypt it into ~/Dropbox/Encrypted, which will then be synced to your cloud storage.

To mount your EncFS folder on every boot, follow the instructions in the EncFS wiki page.

提示:Consider using the ENCFS6_CONFIG variable and moving the .encfs6.xml file to another location (like a USB stick), to help ensure that your encrypted data and the means to realistically decrypt it do not exist together online.

Multiple Dropbox instances[編輯 | 編輯原始碼]

If you need to separate or distinguish your data, personal and work usage for example, you can subscribe to Dropbox with different email addresses and have their directories synced by different Dropbox instances running on a single machine.

The basic principle and general how-to are described in the Dropbox Wiki.

To summarize, you can setup new or additional instances with:

mkdir /path/to/.dropbox-alt-1
HOME=/path/to/.dropbox-alt-1 /usr/bin/dropbox start -i

Once that is done, stop any Dropbox instance still running and start them like this:

HOME=/path/to/.dropbox-alt-1 /path/to/.dropbox-alt-1/.dropbox-dist/dropboxd
HOME=/path/to/.dropbox-alt-2 /path/to/.dropbox-alt-2/.dropbox-dist/dropboxd

Pay attention to use different .../.dropbox-dist/dropboxd binaries. Even when setting a custom HOME value, the /opt/dropbox/dropbox or /opt/dropbox/dropboxd wrappers allow only one instance and when started they will kill the one already running.

Dropbox on laptops[編輯 | 編輯原始碼]

Dropbox itself is pretty good at dealing with connectivity problems. If you have a laptop and roam between different network environments, Dropbox will have problems reconnecting if you do not restart it. Try one of the methods described below first, if for some reason the problem remains, you may try one of these hackish solutions: [1], [2].

注意: When using any of these methods, you need to prevent Dropbox from doing a standard autostart by unchecking Dropbox - Preferences - General - Start Dropbox on system startup. This prevents Dropbox from creating the ~/.config/autostart/dropbox.desktop file and thus from starting twice.

Using netctl[編輯 | 編輯原始碼]

For netctl, use ExecUpPost and ExecDownPre respectively in every network profile you use, or for example in /etc/netctl/interfaces/wlan0 to start Dropbox automatically whenever profile on wlan0 is active. Add '|| true' to your command to make sure netctl will bring up your profile, although Dropbox fails to start.

ExecUpPost="any other code; su -c 'DISPLAY=:0 /usr/bin/dropboxd &' your_user || true"
ExecDownPre="any other code; killall dropbox"

Obviously, your_user has to be edited and any other code; can be omitted if you do not have any. The above will make sure that Dropbox is running only if there is a network profile active.

Using NetworkManager[編輯 | 編輯原始碼]

If you have connectivity problem with NetworkManager, try using a dispatcher script: networkmanager-dispatcher-dropboxAUR[損壞的連結:package not found] or networkmanager-dispatcher-dropbox-systemdAUR[損壞的連結:package not found].

Using wicd[編輯 | 編輯原始碼]

Create /etc/wicd/scripts/postconnect/dropbox:

#!/usr/bin/env bash
su -c 'DISPLAY=:0 /usr/bin/dbus-launch dropboxd &' your_username

or, if you use dropbox with systemd:

#!/usr/bin/env bash
systemctl restart dropbox@<user>

Create /etc/wicd/scripts/postdisconnect/dropbox:

#!/usr/bin/env bash
killall dropbox

or, if you use dropbox with systemd:

#!/usr/bin/env bash
systemctl stop dropbox@<user>
注意: If you use PCManFM as your file manager, Dropbox will use 'xdg-open' calls pcmanfm to open the Dropbox folder.However, without a dbus session, you can not use Trash in PCManFM. You should refer to Dbus and General troubleshooting#Session permissionsto edit your ~/.xinitrc based on /etc/skel/.xinitrc to start a D-Bus session before your launch any other program in ~/.xinitrc. Do use 'dbus-launch dropboxd' instead of just 'dropboxd' in wicd postconnect script. otherwise pcmanfm launched by clicking dropbox icon can not use the Trash.

Troubleshooting[編輯 | 編輯原始碼]

Dropbox keeps saying Downloading files[編輯 | 編輯原始碼]

But in fact now files are synced with your box. This problem is likely to appear when your Dropbox folder is located on a NTFS partition whose mount path contains spaces, or permissions are not set for that partition. See more in the forums. To resolve the problem pay attention to your entry in /etc/fstab. Avoid spaces in the mount path and set write permissions with the "default_permissions" option:

UUID=01CD2ABB65E17DE0 /run/media/username/Windows ntfs-3g uid=username,gid=users,default_permissions 0 0

Change the Dropbox location from the installation wizard[編輯 | 編輯原始碼]

Some users experience the problem during setting-up Dropbox that they cannot select a Dropbox folder other than /home/username/Dropbox. In this case when the window for changing the path is shown , hit Ctrl+l, enter the location (e.g. /mnt/data/Dropbox) and click on the '"Choose" or "Open" button.

Context menu entries in file manager do not work[編輯 | 編輯原始碼]

Several file managers such as Thunar, GNOME Files or its fork Nemo come with extensions that provide context menu entries for files and folders inside your Dropbox. Most of them will result in a browser action such as opening the file or folder in dropbox.com or sharing the link. If you experience these entries not working, then it is likely you have not set the $BROWSER variable which Dropbox requires. See Environment variables for details.

Connecting...[編輯 | 編輯原始碼]

It may happen that Dropbox cannot connect successfully because it was loaded before an internet connection was established. This can happen on wireless connections, or fast loading machines on wired networks. The best solution to this problem, for wired and wireless connections, is #Dropbox on laptops which will ensure that Dropbox is started only after the connection is established.

An alternative solution, for those not using netctl or NetworkManager, is to delay the startup of dropbox:

  • cp ~/.config/autostart/dropbox.desktop ~/.config/autostart/dropbox-delayed.desktop
  • Prevent dropbox from doing a standard autostart by unchecking Dropbox - Preferences - General - Start Dropbox on system startup. This removes ~/.config/autostart/dropbox.desktop.
  • Edit ~/.config/autostart/dropbox-delayed.desktop and replace Exec=dropboxd with Exec=bash -c "sleep timeout && dropboxd". Tweak the timeout parameter, the value of 3 is a good start.

Dropbox does not start - "This is usually because of a permission error"[編輯 | 編輯原始碼]

Check permissions[編輯 | 編輯原始碼]

Make sure that you own Dropbox's directories before running the application. This includes

  • ~/.dropbox - Dropbox's configuration directory
  • ~/Dropbox - Dropbox's download directory (default)

You can ensure this by changing their owner with chown -R.

This error could also be caused by /var being full.

Re-linking your account[編輯 | 編輯原始碼]

Dropbox's FAQ suggests that this error may be caused by misconfiguration and is fixed by (re)moving the current configuration folder

# mv ~/.dropbox ~/.dropbox.old

and restarting Dropbox.

Errors caused by running out of space[編輯 | 編輯原始碼]

A common error that might happen is that there is no more available space on your /tmp and /var partitions. If this happens, Dropbox will crash on startup with the following error in its log:

Exception: Not a valid FileCache file

A detailed story of such an occurrence can be found in the forums. Make sure there is enough space available before launching Dropbox.

Another case is when the root partition is full:

OperationalError: database or disk is full

Check to see the available space on partitions with df.

Locale caused errors[編輯 | 編輯原始碼]

Try starting dropboxd with this code:

LANG=$LOCALE
dropboxd

(You can also use a different value for LANG; it must be in the format "en_US.UTF-8") This helps when running from a Bash script or Bash shell where /etc/rc.d/functions has been loaded

Filesystem monitoring problem[編輯 | 編輯原始碼]

If you have a lot of files to sync in your Dropbox folder, you might get the following error:

Unable to monitor filesystem
Please run: echo 100000 | sudo tee /proc/sys/fs/inotify/max_user_watches and restart Dropbox to correct the problem.

This can be fixed easily by adding

fs.inotify.max_user_watches = 100000

to /etc/sysctl.d/99-sysctl.conf and then reload the kernel parameters

# sysctl --system

代理設置[編輯 | 編輯原始碼]

最簡單的方法是在 Dropbox 的首選項頁面設置代理。另外也可以設置為自動選擇代理,它將會讀取 http_proxy 的變量而使用合適的代理。

env http_proxy=http://your.proxy.here:port /usr/bin/dropboxd

或者

export http_proxy=http://your.proxy.here:port
/usr/bin/dropboxd
注意: Dropbox 僅支持此形式的 http://your.proxy.here:port 代理表示方法, 此表示方法不被支持 your.proxy.here:port(大部分程序都不支持此方法) 。

不要讓它自動升級[編輯 | 編輯原始碼]

rm -rf ~/.dropbox-dist
install -dm0 ~/.dropbox-dist