.\" Automatically generated by Podwrapper::Man 1.32.7 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "virt-edit 1" .TH virt-edit 1 "2016-08-08" "libguestfs-1.32.7" "Virtualization Support" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "НАЗВА" .IX Header "НАЗВА" virt-edit — програма для редагування файлів у віртуальній машині .SH "КОРОТКИЙ ОПИС" .IX Header "КОРОТКИЙ ОПИС" .Vb 1 \& virt\-edit [\-\-параметри] \-d назва_домену файл [файл ...] \& \& virt\-edit [\-\-options] \-a диск.img [\-a диск.img ...] файл [файл ...] \& \& virt\-edit [\-d назва_домену|\-a диск.img] файл \-e \*(Aqвираз\*(Aq .Ve .PP Застарілий стиль: .PP .Vb 1 \& virt\-edit назва_домену файл \& \& virt\-edit диск.img [диск.img ...] файл .Ve .SH "ОПИС" .IX Header "ОПИС" \&\f(CW\*(C`virt\-edit\*(C'\fR is a command line tool to edit \f(CW\*(C`file\*(C'\fR where each \f(CW\*(C`file\*(C'\fR exists in the named virtual machine (or disk image). .PP Ви можете вказати декілька назв файлів. Вміст таких файлів буде редаговано послідовно. Назви файлів слід вказувати повністю (разом зі шляхом), починаючи з кореневого каталогу (тобто назва має починатися з «/»). .PP Якщо ви просто хочете переглянути файл, скористайтеся \fIvirt\-cat\fR\|(1). .PP Для виконання складніших дій можна скористатися програмою \fIguestfish\fR\|(1) (див. \*(L"\s-1USING GUESTFISH\*(R"\s0 нижче). .PP \&\f(CW\*(C`virt\-edit\*(C'\fR cannot be used to create a new file. \fIguestfish\fR\|(1) can do that and much more. .SH "ПРИКЛАДИ" .IX Header "ПРИКЛАДИ" Інтерактивне редагування іменованих файлів: .PP .Vb 1 \& virt\-edit \-d mydomain /boot/grub/grub.conf \& \& virt\-edit \-d mydomain /etc/passwd .Ve .PP For Windows guests, some Windows paths are understood: .PP .Vb 1 \& virt\-edit \-d mywindomain \*(Aqc:\eautoexec.bat\*(Aq .Ve .PP If Perl is installed, you can also edit files non-interactively (see \&\*(L"NON-INTERACTIVE \s-1EDITING\*(R"\s0 below). To change the init default level to 5: .PP .Vb 1 \& virt\-edit \-d mydomain /etc/inittab \-e \*(Aqs/^id:.*/id:5:initdefault:/\*(Aq .Ve .SH "ПАРАМЕТРИ" .IX Header "ПАРАМЕТРИ" .IP "\fB\-\-help\fR" 4 .IX Item "--help" Показати коротку довідку. .IP "\fB\-a\fR файл" 4 .IX Item "-a файл" .PD 0 .IP "\fB\-\-add\fR файл" 4 .IX Item "--add файл" .PD Add \fIfile\fR which should be a disk image from a virtual machine. If the virtual machine has multiple block devices, you must supply all of them with separate \fI\-a\fR options. .Sp Формат образу диска визначається автоматично. Щоб перевизначити його і примусово використати певний формат, скористайтеся параметром \&\fI\-\-format=..\fR. .IP "\fB\-a адреса\fR" 4 .IX Item "-a адреса" .PD 0 .IP "\fB\-\-add адреса\fR" 4 .IX Item "--add адреса" .PD Додати віддалений диск. Див. \*(L"ДОДАВАННЯ ВІДДАЛЕНОГО СХОВИЩА\*(R" in \fIguestfish\fR\|(1). .IP "\fB\-b\fR суфікс" 4 .IX Item "-b суфікс" .PD 0 .IP "\fB\-\-backup\fR суфікс" 4 .IX Item "--backup суфікс" .PD Create a backup of the original file \fIin the guest disk image\fR. The backup has the original filename with \f(CW\*(C`extension\*(C'\fR added. .Sp Usually the first character of \f(CW\*(C`extension\*(C'\fR would be a dot \f(CW\*(C`.\*(C'\fR so you would write: .Sp .Vb 1 \& virt\-edit \-b .orig [тощо] .Ve .Sp Типово створюється файл резервної копії. .IP "\fB\-c адреса\fR" 4 .IX Item "-c адреса" .PD 0 .IP "\fB\-\-connect адреса\fR" 4 .IX Item "--connect адреса" .PD Якщо використовується libvirt, встановити з’єднання з вказаним \fI\s-1URI\s0\fR. Якщо пропущено, з’єднання буде встановлено з типовим гіпервізором libvirt. .Sp Якщо вказати блокові пристрої гостьових систем безпосередньо, libvirt не буде використовуватися взагалі. .IP "\fB\-d\fR гість" 4 .IX Item "-d гість" .PD 0 .IP "\fB\-\-domain\fR гість" 4 .IX Item "--domain гість" .PD Додати всі диски з вказаної гостьової системи libvirt. \s-1UUID\s0 доменів можна використовувати замість назв. .IP "\fB\-\-echo\-keys\fR" 4 .IX Item "--echo-keys" When prompting for keys and passphrases, virt-edit normally turns echoing off so you cannot see what you are typing. If you are not worried about Tempest attacks and there is no one else in the room you can specify this flag to see what you are typing. .IP "\fB\-e\fR вираз" 4 .IX Item "-e вираз" .PD 0 .IP "\fB\-\-edit\fR ВИРАЗ" 4 .IX Item "--edit ВИРАЗ" .IP "\fB\-\-expr\fR вираз" 4 .IX Item "--expr вираз" .PD Instead of launching the external editor, non-interactively apply the Perl expression \f(CW\*(C`EXPR\*(C'\fR to each line in the file. See \*(L"NON-INTERACTIVE \&\s-1EDITING\*(R"\s0 below. .Sp Be careful to properly quote the expression to prevent it from being altered by the shell. .Sp Note that this option is only available when Perl 5 is installed. .IP "\fB\-\-format=raw|qcow2|..\fR" 4 .IX Item "--format=raw|qcow2|.." .PD 0 .IP "\fB\-\-format\fR" 4 .IX Item "--format" .PD Типовим значенням для параметра \fI\-a\fR є автоматичне визначення формату образу диска. Використання цього параметра примусово визначає значення параметрів \fI\-a\fR формату диска у наступному рядку команди. Використання параметра \fI\-\-format\fR без аргументу перемикає програму у режим автоматичного визначення у наступних параметрах \fI\-a\fR. .Sp Приклад: .Sp .Vb 1 \& virt\-edit \-\-format=raw \-a диск.img файл .Ve .Sp примусове встановлення формату без обробки (без автоматичного визначення) для \fIdisk.img\fR. .Sp .Vb 1 \& virt\-edit \-\-format=raw \-a disk.img \-\-format \-a another.img file .Ve .Sp примусове встановлення формату без обробки (без автоматичного визначення) для \fIdiskimg\fR і повернення до автоматичного визначення для \fIanother.img\fR. .Sp Якщо ви користуєтеся ненадійними образами гостьових систем у необробленому форматі, вам слід скористатися цим параметром для визначення формату диска. Таким чином можна уникнути можливих проблем з захистом для сформованих зловмисниками гостьових систем (\s-1CVE\-2010\-3851\s0). .IP "\fB\-\-keys\-from\-stdin\fR" 4 .IX Item "--keys-from-stdin" Read key or passphrase parameters from stdin. The default is to try to read passphrases from the user by opening \fI/dev/tty\fR. .IP "\fB\-m пристрій[:точка_монтування[:параметри[:тип_файлової_системи]]]\fR" 4 .IX Item "-m пристрій[:точка_монтування[:параметри[:тип_файлової_системи]]]" .PD 0 .IP "\fB\-\-mount пристрій[:точка_монтування[:параметри[:тип_файлової_системи]]]\fR" 4 .IX Item "--mount пристрій[:точка_монтування[:параметри[:тип_файлової_системи]]]" .PD Змонтувати названий розділ або логічний том до вказаної точки монтування. .Sp If the mountpoint is omitted, it defaults to \fI/\fR. .Sp Specifying any mountpoint disables the inspection of the guest and the mount of its root and all of its mountpoints, so make sure to mount all the mountpoints needed to work with the filenames given as arguments. .Sp If you don't know what filesystems a disk image contains, you can either run guestfish without this option, then list the partitions, filesystems and LVs available (see \*(L"list-partitions\*(R", \*(L"list-filesystems\*(R" and \*(L"lvs\*(R" commands), or you can use the \fIvirt\-filesystems\fR\|(1) program. .Sp The third (and rarely used) part of the mount parameter is the list of mount options used to mount the underlying filesystem. If this is not given, then the mount options are either the empty string or \f(CW\*(C`ro\*(C'\fR (the latter if the \&\fI\-\-ro\fR flag is used). By specifying the mount options, you override this default choice. Probably the only time you would use this is to enable ACLs and/or extended attributes if the filesystem can support them: .Sp .Vb 1 \& \-m /dev/sda1:/:acl,user_xattr .Ve .Sp Using this flag is equivalent to using the \f(CW\*(C`mount\-options\*(C'\fR command. .Sp The fourth part of the parameter is the filesystem driver to use, such as \&\f(CW\*(C`ext3\*(C'\fR or \f(CW\*(C`ntfs\*(C'\fR. This is rarely needed, but can be useful if multiple drivers are valid for a filesystem (eg: \f(CW\*(C`ext2\*(C'\fR and \f(CW\*(C`ext3\*(C'\fR), or if libguestfs misidentifies a filesystem. .IP "\fB\-v\fR" 4 .IX Item "-v" .PD 0 .IP "\fB\-\-verbose\fR" 4 .IX Item "--verbose" .PD Увімкнути докладний показ повідомлень з метою діагностики. .IP "\fB\-V\fR" 4 .IX Item "-V" .PD 0 .IP "\fB\-\-version\fR" 4 .IX Item "--version" .PD Показати дані щодо версії і завершити роботу. .IP "\fB\-x\fR" 4 .IX Item "-x" Увімкнути трасування викликів програмного інтерфейсу libguestfs. .SH "ПАРАМЕТРИ КОМАНДНОГО РЯДКА У ФОРМАТІ ПОПЕРЕДНІХ ВЕРСІЙ" .IX Header "ПАРАМЕТРИ КОМАНДНОГО РЯДКА У ФОРМАТІ ПОПЕРЕДНІХ ВЕРСІЙ" У попередніх версіях virt-edit можна було використовувати або .PP .Vb 1 \& virt\-edit диск.img [диск.img ...] файл .Ve .PP або .PP .Vb 1 \& virt\-edit назва_гостьової_системи файл .Ve .PP whereas in this version you should use \fI\-a\fR or \fI\-d\fR respectively to avoid the confusing case where a disk image might have the same name as a guest. .PP З міркувань зворотної сумісності передбачено підтримку запису параметрів у застарілому форматі. .SH "НЕІНТЕРАКТИВНЕ РЕДАГУВАННЯ" .IX Header "НЕІНТЕРАКТИВНЕ РЕДАГУВАННЯ" \&\f(CW\*(C`virt\-edit\*(C'\fR normally calls out to \f(CW$EDITOR\fR (or vi) so the system administrator can interactively edit the file. .PP There are two ways also to use \f(CW\*(C`virt\-edit\*(C'\fR from scripts in order to make automated edits to files. (Note that although you \fIcan\fR use \f(CW\*(C`virt\-edit\*(C'\fR like this, it's less error-prone to write scripts directly using the libguestfs \s-1API\s0 and Augeas for configuration file editing.) .PP The first method is to temporarily set \f(CW$EDITOR\fR to any script or program you want to run. The script is invoked as \f(CW\*(C`$EDITOR tmpfile\*(C'\fR and it should update \f(CW\*(C`tmpfile\*(C'\fR in place however it likes. .PP The second method is to use the \fI\-e\fR parameter of \f(CW\*(C`virt\-edit\*(C'\fR to run a short Perl snippet in the style of \fIsed\fR\|(1). For example to replace all instances of \f(CW\*(C`foo\*(C'\fR with \f(CW\*(C`bar\*(C'\fR in a file: .PP .Vb 1 \& virt\-edit \-d domname filename \-e \*(Aqs/foo/bar/\*(Aq .Ve .PP The full power of Perl regular expressions can be used (see \fIperlre\fR\|(1)). For example to delete root's password you could do: .PP .Vb 1 \& virt\-edit \-d назва_домену /etc/passwd \-e \*(Aqs/^root:.*?:/root::/\*(Aq .Ve .PP What really happens is that the snippet is evaluated as a Perl expression for each line of the file. The line, including the final \f(CW\*(C`\en\*(C'\fR, is passed in \f(CW$_\fR and the expression should update \f(CW$_\fR or leave it unchanged. .PP To delete a line, set \f(CW$_\fR to the empty string. For example, to delete the \&\f(CW\*(C`apache\*(C'\fR user account from the password file you can do: .PP .Vb 1 \& virt\-edit \-d mydomain /etc/passwd \-e \*(Aq$_ = "" if /^apache:/\*(Aq .Ve .PP To insert a line, prepend or append it to \f(CW$_\fR. However appending lines to the end of the file is rather difficult this way since there is no concept of \*(L"last line of the file\*(R" \- your expression just doesn't get called again. You might want to use the first method (setting \f(CW$EDITOR\fR) if you want to do this. .PP The variable \f(CW$lineno\fR contains the current line number. As is traditional, the first line in the file is number \f(CW1\fR. .PP The return value from the expression is ignored, but the expression may call \&\f(CW\*(C`die\*(C'\fR in order to abort the whole program, leaving the original file untouched. .PP Remember when matching the end of a line that \f(CW$_\fR may contain the final \&\f(CW\*(C`\en\*(C'\fR, or (for \s-1DOS\s0 files) \f(CW\*(C`\er\en\*(C'\fR, or if the file does not end with a newline then neither of these. Thus to match or substitute some text at the end of a line, use this regular expression: .PP .Vb 1 \& /якийсь текст(\er?\en)?$/ .Ve .PP Alternately, use the perl \f(CW\*(C`chomp\*(C'\fR function, being careful not to chomp \&\f(CW$_\fR itself (since that would remove all newlines from the file): .PP .Vb 1 \& my $m = $_; chomp $m; $m =~ /якийсь текст$/ .Ve .SH "ШЛЯХИ У WINDOWS" .IX Header "ШЛЯХИ У WINDOWS" \&\f(CW\*(C`virt\-edit\*(C'\fR has a limited ability to understand Windows drive letters and paths (eg. \fIE:\efoo\ebar.txt\fR). .PP Тоді і лише тоді, коли у гостьовій системі працює Windows: .IP "\(bu" 4 Drive letter prefixes like \f(CW\*(C`C:\*(C'\fR are resolved against the Windows Registry to the correct filesystem. .IP "\(bu" 4 Any backslash (\f(CW\*(C`\e\*(C'\fR) characters in the path are replaced with forward slashes so that libguestfs can process it. .IP "\(bu" 4 The path is resolved case insensitively to locate the file that should be edited. .PP Відомі певні недоліки програми: .IP "\(bu" 4 Перехід за деякими символічними посиланнями \s-1NTFS\s0 може здійснюватися з помилками. .IP "\(bu" 4 \&\s-1NTFS\s0 junction points that cross filesystems are not followed. .SH "ВИКОРИСТАННЯ GUESTFISH" .IX Header "ВИКОРИСТАННЯ GUESTFISH" \&\fIguestfish\fR\|(1) is a more powerful, lower level tool which you can use when \&\f(CW\*(C`virt\-edit\*(C'\fR doesn't work. .PP Using \f(CW\*(C`virt\-edit\*(C'\fR is approximately equivalent to doing: .PP .Vb 1 \& guestfish \-\-rw \-i \-d назва_домену edit /файл .Ve .PP where \f(CW\*(C`domname\*(C'\fR is the name of the libvirt guest, and \fI/file\fR is the full path to the file. .PP The command above uses libguestfs's guest inspection feature and so does not work on guests that libguestfs cannot inspect, or on things like arbitrary disk images that don't contain guests. To edit a file on a disk image directly, use: .PP .Vb 1 \& guestfish \-\-rw \-a диск.img \-m /dev/sda1 edit /файл .Ve .PP where \fIdisk.img\fR is the disk image, \fI/dev/sda1\fR is the filesystem within the disk image to edit, and \fI/file\fR is the full path to the file. .PP \&\f(CW\*(C`virt\-edit\*(C'\fR cannot create new files. Use the guestfish commands \f(CW\*(C`touch\*(C'\fR, \&\f(CW\*(C`write\*(C'\fR or \f(CW\*(C`upload\*(C'\fR instead: .PP .Vb 1 \& guestfish \-\-rw \-i \-d назва_домену touch /новий_файл \& \& guestfish \-\-rw \-i \-d назва_домену write /новий_файл "новий вміст" \& \& guestfish \-\-rw \-i \-d domname upload localfile /newfile .Ve .SH "ЗМІННІ СЕРЕДОВИЩА" .IX Header "ЗМІННІ СЕРЕДОВИЩА" .ie n .IP """EDITOR""" 4 .el .IP "\f(CWEDITOR\fR" 4 .IX Item "EDITOR" If set, this string is used as the editor. It may contain arguments, eg. \f(CW"emacs \-nw"\fR .Sp Якщо не встановлено, використовуватиметься \f(CW\*(C`vi\*(C'\fR. .SH "СТАН ВИХОДУ" .IX Header "СТАН ВИХОДУ" Ця програма повертає значення 0 у разі успішного завершення і ненульове значення, якщо сталася помилка. .SH "ТАКОЖ ПЕРЕГЛЯНЬТЕ" .IX Header "ТАКОЖ ПЕРЕГЛЯНЬТЕ" \&\fIguestfs\fR\|(3), \fIguestfish\fR\|(1), \fIvirt\-cat\fR\|(1), \fIvirt\-copy\-in\fR\|(1), \&\fIvirt\-tar\-in\fR\|(1), http://libguestfs.org/, \fIperl\fR\|(1), \fIperlre\fR\|(1). .SH "АВТОР" .IX Header "АВТОР" Richard W.M. Jones http://people.redhat.com/~rjones/ .SH "АВТОРСЬКІ ПРАВА" .IX Header "АВТОРСЬКІ ПРАВА" Copyright (C) 2009\-2016 Red Hat Inc. .SH "LICENSE" .IX Header "LICENSE" .SH "BUGS" .IX Header "BUGS" To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools .PP To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools .PP When reporting a bug, please supply: .IP "\(bu" 4 The version of libguestfs. .IP "\(bu" 4 Where you got libguestfs (eg. which Linux distro, compiled from source, etc) .IP "\(bu" 4 Describe the bug accurately and give a way to reproduce it. .IP "\(bu" 4 Run \fIlibguestfs\-test\-tool\fR\|(1) and paste the \fBcomplete, unedited\fR output into the bug report.