fuse: Add note about allowing other users to see filesystem (RHBZ#705200).
[libguestfs.git] / fuse / guestmount.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 guestmount - Mount a guest filesystem on the host using FUSE and libguestfs
6
7 =head1 SYNOPSIS
8
9  guestmount [--options] -a disk.img -m device [--ro] mountpoint
10
11  guestmount [--options] -a disk.img -i [--ro] mountpoint
12
13  guestmount [--options] -d Guest -i [--ro] mountpoint
14
15 =head1 WARNING
16
17 You must I<not> use C<guestmount> in read-write mode on live virtual
18 machines.  If you do this, you risk disk corruption in the VM.
19
20 =head1 DESCRIPTION
21
22 The guestmount program can be used to mount virtual machine
23 filesystems and other disk images on the host.  It uses libguestfs for
24 access to the guest filesystem, and FUSE (the "filesystem in
25 userspace") to make it appear as a mountable device.
26
27 Along with other options, you have to give at least one device (I<-a>
28 option) or libvirt domain (I<-d> option), and at least one mountpoint
29 (I<-m> option) or use the I<-i> inspection option.  How this works is
30 better explained in the L<guestfish(1)> manual page, or by looking at
31 the examples below.
32
33 FUSE lets you mount filesystems as non-root.  The mountpoint must be
34 owned by you, and the filesystem will not be visible to any other
35 users unless you make certain global configuration changes to
36 C</etc/fuse.conf>.  To unmount the filesystem, use the C<fusermount -u>
37 command.
38
39 =head1 EXAMPLES
40
41 For a typical Windows guest which has its main filesystem on the
42 first partition:
43
44  guestmount -a windows.img -m /dev/sda1 --ro /mnt
45
46 For a typical Linux guest which has a /boot filesystem on the first
47 partition, and the root filesystem on a logical volume:
48
49  guestmount -a linux.img -m /dev/VG/LV -m /dev/sda1:/boot --ro /mnt
50
51 To get libguestfs to detect guest mountpoints for you:
52
53  guestmount -a guest.img -i --ro /mnt
54
55 For a libvirt guest called "Guest" you could do:
56
57  guestmount -d Guest -i --ro /mnt
58
59 If you don't know what filesystems are contained in a guest or
60 disk image, use L<virt-filesystems(1)> first:
61
62  virt-filesystems MyGuest
63
64 If you want to trace the libguestfs calls but without excessive
65 debugging information, we recommend:
66
67  guestmount [...] --trace /mnt
68
69 If you want to debug the program, we recommend:
70
71  guestmount [...] --trace --verbose /mnt
72
73 =head1 NOTES
74
75 =head2 Other users cannot see the filesystem by default
76
77 If you mount a filesystem as one user (eg. root), then other users
78 will not be able to see it by default.  The fix is to add the FUSE
79 C<allow_other> option when mounting:
80
81  sudo guestmount [...] -o allow_other /mnt
82
83 =head1 OPTIONS
84
85 =over 4
86
87 =item B<-a image> | B<--add image>
88
89 Add a block device or virtual machine image.
90
91 The format of the disk image is auto-detected.  To override this and
92 force a particular format use the I<--format=..> option.
93
94 =item B<-c URI> | B<--connect URI>
95
96 When used in conjunction with the I<-d> option, this specifies
97 the libvirt URI to use.  The default is to use the default libvirt
98 connection.
99
100 =item B<-d libvirt-domain> | B<--domain libvirt-domain>
101
102 Add disks from the named libvirt domain.  If the I<--ro> option is
103 also used, then any libvirt domain can be used.  However in write
104 mode, only libvirt domains which are shut down can be named here.
105
106 Domain UUIDs can be used instead of names.
107
108 =item B<--dir-cache-timeout N>
109
110 Set the readdir cache timeout to I<N> seconds, the default being 60
111 seconds.  The readdir cache [actually, there are several
112 semi-independent caches] is populated after a readdir(2) call with the
113 stat and extended attributes of the files in the directory, in
114 anticipation that they will be requested soon after.
115
116 There is also a different attribute cache implemented by FUSE
117 (see the FUSE option I<-o attr_timeout>), but the FUSE cache
118 does not anticipate future requests, only cache existing ones.
119
120 =item B<--echo-keys>
121
122 When prompting for keys and passphrases, guestfish normally turns
123 echoing off so you cannot see what you are typing.  If you are not
124 worried about Tempest attacks and there is no one else in the room
125 you can specify this flag to see what you are typing.
126
127 =item B<--format=raw|qcow2|..> | B<--format>
128
129 The default for the I<-a> option is to auto-detect the format of the
130 disk image.  Using this forces the disk format for I<-a> options which
131 follow on the command line.  Using I<--format> with no argument
132 switches back to auto-detection for subsequent I<-a> options.
133
134 If you have untrusted raw-format guest disk images, you should use
135 this option to specify the disk format.  This avoids a possible
136 security problem with malicious guests (CVE-2010-3851).  See also
137 L<guestfs(3)/guestfs_add_drive_opts>.
138
139 =item B<--fuse-help>
140
141 Display help on special FUSE options (see I<-o> below).
142
143 =item B<--help>
144
145 Display brief help and exit.
146
147 =item B<-i> | B<--inspector>
148
149 Using L<virt-inspector(1)> code, inspect the disks looking for
150 an operating system and mount filesystems as they would be
151 mounted on the real virtual machine.
152
153 =item B<--keys-from-stdin>
154
155 Read key or passphrase parameters from stdin.  The default is
156 to try to read passphrases from the user by opening C</dev/tty>.
157
158 =item B<--live>
159
160 Connect to a live virtual machine.
161 (Experimental, see L<guestfs(3)/ATTACHING TO RUNNING DAEMONS>).
162
163 =item B<-m dev[:mountpoint[:options]]>
164
165 =item B<--mount dev[:mountpoint[:options]]>
166
167 Mount the named partition or logical volume on the given mountpoint
168 B<in the guest> (this has nothing to do with mountpoints in the host).
169
170 If the mountpoint is omitted, it defaults to C</>.  You have to mount
171 something on C</>.
172
173 The third (and rarely used) part of the mount parameter is the list of
174 mount options used to mount the underlying filesystem.  If this is not
175 given, then the mount options are either the empty string or C<ro>
176 (the latter if the I<--ro> flag is used).  By specifying the mount
177 options, you override this default choice.  Probably the only time you
178 would use this is to enable ACLs and/or extended attributes if the
179 filesystem can support them:
180
181  -m /dev/sda1:/:acl,user_xattr
182
183 =item B<-n> | B<--no-sync>
184
185 By default, we attempt to sync the guest disk when the FUSE mountpoint
186 is unmounted.  If you specify this option, then we don't attempt to
187 sync the disk.  See the discussion of autosync in the L<guestfs(3)>
188 manpage.
189
190 =item B<-o option> | B<--option option>
191
192 Pass extra options to FUSE.
193
194 To get a list of all the extra options supported by FUSE, use the
195 command below.  Note that only the FUSE I<-o> options can be passed,
196 and only some of them are a good idea.
197
198  guestmount --fuse-help
199
200 Some potentially useful FUSE options:
201
202 =over 4
203
204 =item B<-o allow_other>
205
206 Allow other users to see the filesystem.
207
208 =item B<-o attr_timeout=N>
209
210 Enable attribute caching by FUSE, and set the timeout to I<N> seconds.
211
212 =item B<-o kernel_cache>
213
214 Allow the kernel to cache files (reduces the number of reads
215 that have to go through the L<guestfs(3)> API).  This is generally
216 a good idea if you can afford the extra memory usage.
217
218 =item B<-o uid=N> B<-o gid=N>
219
220 Use these options to map all UIDs and GIDs inside the guest filesystem
221 to the chosen values.
222
223 =back
224
225 =item B<-r> | B<--ro>
226
227 Add devices and mount everything read-only.  Also disallow writes and
228 make the disk appear read-only to FUSE.
229
230 This is highly recommended if you are not going to edit the guest
231 disk.  If the guest is running and this option is I<not> supplied,
232 then there is a strong risk of disk corruption in the guest.  We try
233 to prevent this from happening, but it is not always possible.
234
235 See also L<guestfish(1)/OPENING DISKS FOR READ AND WRITE>.
236
237 =item B<--selinux>
238
239 Enable SELinux support for the guest.
240
241 =item B<-v> | B<--verbose>
242
243 Enable verbose messages from underlying libguestfs.
244
245 =item B<-V> | B<--version>
246
247 Display the program version and exit.
248
249 =item B<-w> | B<--rw>
250
251 This changes the I<-a>, I<-d> and I<-m> options so that disks are
252 added and mounts are done read-write.
253
254 See L<guestfish(1)/OPENING DISKS FOR READ AND WRITE>.
255
256 =item B<-x> | B<--trace>
257
258 Trace libguestfs calls and entry into each FUSE function.
259
260 This also stops the daemon from forking into the background.
261
262 =back
263
264 =head1 FILES
265
266 =over 4
267
268 =item $HOME/.libguestfs-tools.rc
269
270 =item /etc/libguestfs-tools.conf
271
272 This configuration file controls the default read-only or read-write
273 mode (I<--ro> or I<--rw>).
274
275 See L<guestfish(1)/OPENING DISKS FOR READ AND WRITE>.
276
277 =back
278
279 =head1 SEE ALSO
280
281 L<guestfish(1)>,
282 L<virt-inspector(1)>,
283 L<virt-cat(1)>,
284 L<virt-edit(1)>,
285 L<virt-tar(1)>,
286 L<guestfs(3)>,
287 L<http://libguestfs.org/>,
288 L<http://fuse.sf.net/>.
289
290 =head1 AUTHORS
291
292 Richard W.M. Jones (C<rjones at redhat dot com>)
293
294 =head1 COPYRIGHT
295
296 Copyright (C) 2009-2010 Red Hat Inc.
297 L<http://libguestfs.org/>
298
299 This program is free software; you can redistribute it and/or modify
300 it under the terms of the GNU General Public License as published by
301 the Free Software Foundation; either version 2 of the License, or
302 (at your option) any later version.
303
304 This program is distributed in the hope that it will be useful,
305 but WITHOUT ANY WARRANTY; without even the implied warranty of
306 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
307 GNU General Public License for more details.
308
309 You should have received a copy of the GNU General Public License
310 along with this program; if not, write to the Free Software
311 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.