-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAutomount_USB_and_HDD.txt
60 lines (48 loc) · 2.28 KB
/
Automount_USB_and_HDD.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2016-12-31T03:38:27+01:00
====== Automount USB and HDD ======
Created Saturday 31 December 2016
**We'll need **//Udisk2//** to read/write to our external devices and **//Udevil//** to automatic mount the devices when plugged in. We'll also add some extra partition scheme support - **//fat//** and **//ntfs//** to be specific. **
== Usage ==
**# Once the installation steps below has been completed, devices should mount automatic. **
**# Devices will be mounted at **///media/<USER_NAME>/<DEVICE_NAME>//
**# You need to manual unmount the device once you're done (always do this before unplugging)**
$ udevil unmount /media///<USER_NAME>/////<DEVICE_NAME>//
== Installation ==
**# For **//ntfs //**and **//fat//** support **
$ pacman -S ntfs-3g dosfstools
**# For mount/auto-mount **
$ pacman -S udisks2 udevil
**# Remove the SUID permission from **//Udevil //**(with sudo)**
$ chmod u+s,go-s,ugo+x /usr/bin/udevil
**# Enable the service file, taking the **//username//** as an argument **
$ systemctl enable devmon@//<USER_NAME>//.service
**# Create a file in **///etc/polkit-1/rules.d/50-udevil.rules//
{{{code: lang="texinfo" linenumbers="True"
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
// NOTE: there must be a comma at the end of each line except for the last:
var permission = {
// required for udisks1:
"org.freedesktop.udisks.filesystem-mount": YES,
"org.freedesktop.udisks.luks-unlock": YES,
"org.freedesktop.udisks.drive-eject": YES,
"org.freedesktop.udisks.drive-detach": YES,
// required for udisks2:
"org.freedesktop.udisks2.filesystem-mount": YES,
"org.freedesktop.udisks2.encrypted-unlock": YES,
"org.freedesktop.udisks2.eject-media": YES,
"org.freedesktop.udisks2.power-off-drive": YES,
// required for udisks2 if using udiskie from another seat (e.g. systemd):
"org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
"org.freedesktop.udisks2.filesystem-unmount-others": YES,
"org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
"org.freedesktop.udisks2.eject-media-other-seat": YES,
"org.freedesktop.udisks2.power-off-drive-other-seat": YES
};
if (subject.isInGroup("storage")) {
return permission[action.id];
}
});
}}}