https://wiki.archlinux.org/api.php?action=feedcontributions&user=Self-Perfection&feedformat=atomArchWiki - User contributions [en]2024-03-29T00:51:50ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Disk_cloning&diff=473701Disk cloning2017-04-11T22:17:09Z<p>Self-Perfection: Update: Partimage is no longer developed, developers switched to FSArchiver.</p>
<hr />
<div>[[Category:Data compression and archiving]]<br />
[[Category:System recovery]]<br />
[[it:Disk cloning]]<br />
[[ja:ディスクのクローン]]<br />
[[ru:Disk cloning]]<br />
[[tr:Disk klonlama]]<br />
[[zh-hans:Disk cloning]]<br />
Disk cloning is the process of making an image of a partition or of an entire hard drive. This can be useful for copying the drive to other computers and for [[backup]] and [[File recovery|recovery]] purposes.<br />
<br />
== Using dd ==<br />
<br />
The ''dd'' command is a simple, yet versatile and powerful tool. It can be used to copy from source to destination, block-by-block, regardless of their filesystem types or operating systems. A convenient method is to use ''dd'' from a live environment, as in a Live CD.<br />
<br />
{{Warning|As with any command of this type, you should be very cautious when using it; it can destroy data. Remember the order of input file ({{ic|1=if=}}) and output file ({{ic|1=of=}}) and do not reverse them! Always ensure that the destination drive or partition ({{ic|1=of=}}) is of equal or greater size than the source ({{ic|1=if=}}).<br />
}}<br />
<br />
{{Accuracy|1=Are the conv= options safe to use? See:|section=remove conv sync noerror}} <br />
<br />
=== Cloning a partition ===<br />
<br />
From physical disk {{ic|/dev/sda}}, partition 1, to physical disk {{ic|/dev/sdb}}, partition 1.<br />
# dd if=/dev/sda1 of=/dev/sdb1 bs=64K conv=noerror,sync<br />
<br />
{{Warning|If output file {{ic|1=of=}} ({{ic|sdb1}} in the example) does not exist, ''dd'' will create a file with this name and will start filling up your root file system!}}<br />
<br />
=== Cloning an entire hard disk ===<br />
<br />
From physical disk {{ic|/dev/sd''X''}} to physical disk {{ic|/dev/sd''Y''}}<br />
# dd if=/dev/sd''X'' of=/dev/sd''Y'' bs=64K conv=noerror,sync<br />
<br />
This will clone the entire drive, including the MBR (and therefore bootloader), all partitions, UUIDs, and data.<br />
* {{ic|noerror}} instructs ''dd'' to continue operation, ignoring all read errors. Default behavior for ''dd'' is to halt at any error. <br />
* {{ic|sync}} fills input blocks with zeroes if there were any read errors, so data offsets stay in sync.<br />
* {{ic|1=bs=}} sets the block size. Defaults to 512 bytes, which is the "classic" block size for hard drives since the early 1980s, but is not the most convenient. Use a bigger value, 64K or 128K. Also, please read the warning below, because there is more to this than just "block sizes" -it also influences how read errors propagate. See [http://www.mail-archive.com/eug-lug@efn.org/msg12073.html] and [http://blog.tdg5.com/tuning-dd-block-size/] for details and to figure out the best bs value for your use case.<br />
<br />
{{Warning|The block size you specify influences how read errors are handled. Read below. For data recovery, use [[#Using ddrescue|ddrescue]].}}<br />
<br />
The ''dd'' utility technically has an "input block size" (IBS) and an "output block size" (OBS). When you set {{ic|bs}}, you effectively set both IBS and OBS. Normally, if your block size is, say, 1 MiB, ''dd'' will read 1024*1024 bytes and write as many bytes. But if a read error occurs, things will go wrong. Many people seem to think that ''dd'' will "fill up read errors with zeroes" if you use the {{ic|noerror,sync}} options, but this is not what happens. ''dd'' will, according to documentation, fill up the OBS to IBS size ''after completing its read'', which means adding zeroes at the ''end'' of the block. This means, for a disk, that effectively the whole 1 MiB would become messed up because of a single 512 byte read error in the beginning of the read: 12ERROR89 would become 128900000 instead of 120000089.<br />
<br />
If you are positive that your disk does not contain any errors, you could proceed using a larger block size, which will increase the speed of your copying several fold. For example, changing bs from 512 to 64K changed copying speed from 35 MB/s to 120 MB/s on a simple Celeron 2.7 GHz system. But keep in mind that read errors on the source disk will end up as ''block errors'' on the destination disk, i.e. a single 512-byte read error will mess up the whole 64 KiB output block.<br />
<br />
{{Tip|If you would like to view ''dd'' progressing, use the {{ic|1=status=progress}} option. See [[dd]] for details.}}<br />
<br />
{{Note|<br />
* To regain unique UUIDs of an ''ext2/3/4'' filesystem, use {{ic|tune2fs /dev/sd''XY'' -U random}} on every partition.<br />
* Partition table changes from ''dd'' are not registered by the kernel. To notify of changes without rebooting, use a utility like ''partprobe'' (part of [[GNU Parted]]).<br />
}}<br />
<br />
=== Backing up the partition table ===<br />
<br />
See [[fdisk#Backup and restore partition table]].<br />
<br />
=== Create disk image ===<br />
<br />
1. Boot from a live media.<br />
<br />
2. Make sure no partitions are mounted from the source hard drive.<br />
<br />
3. Mount the external HD<br />
<br />
4. Backup the drive. <br />
# dd if=/dev/sd''X'' conv=sync,noerror bs=64K | gzip -c > ''/path/to/backup.img.gz''<br />
<br />
If necessary (e.g. when the format of the external HD is FAT32) split the disk image in volumes (see also the ''split'' man pages).<br />
<br />
# dd if=/dev/sd''X'' conv=sync,noerror bs=64K | gzip -c | split -a3 -b2G - ''/path/to/backup.img.gz''<br />
<br />
If there is not enough disk space locally, you may send the image through ssh:<br />
<br />
# dd if=/dev/sd''X'' conv=sync,noerror bs=64K | gzip -c | ssh user@local dd of=backup.img.gz<br />
<br />
5. Save extra information about the drive geometry necessary in order to interpret the partition table stored within the image. The most important of which is the cylinder size.<br />
<br />
# fdisk -l /dev/sd''X'' > ''/path/to/list_fdisk.info''<br />
<br />
{{Note|You may wish to use a block size ({{ic|1=bs=}}) that is equal to the amount of cache on the HD you are backing up. For example, {{ic|1=bs=8192K}} works for an 8 MiB cache. The 64 KiB mentioned in this article is better than the default {{ic|1=bs=512}} bytes, but it will run faster with a larger {{ic|1=bs=}}.}}<br />
<br />
=== Restore system ===<br />
<br />
To restore your system:<br />
# gunzip -c ''/path/to/backup.img.gz'' | dd of=/dev/sd''X''<br />
<br />
When the image has been split, use the following instead:<br />
# cat ''/path/to/backup.img.gz*'' | gunzip -c | dd of=/dev/sd''X''<br />
<br />
== Using ddrescue ==<br />
''ddrescue'' is a tool designed for cloning and recovering data. It copies data from one file or block device (hard disc, cdrom, etc) to another, trying to rescue the good parts first in case of read errors, to maximize the recovered data.<br />
<br />
To clone a faulty or dying drive, run ddrescue twice. First round, copy every block without read error and log the errors to rescue.log.<br />
<br />
# ddrescue -f -n /dev/sdX /dev/sdY rescue.log<br />
<br />
Second round, copy only the bad blocks and try 3 times to read from the source before giving up.<br />
<br />
# ddrescue -d -f -r3 /dev/sdX /dev/sdY rescue.log<br />
<br />
Now you can check the file system for corruption and mount the new drive.<br />
<br />
# fsck -f /dev/sdY<br />
<br />
== Using e2image ==<br />
<br />
''e2image'' is a tool included in {{Pkg|e2fsprogs}} for debugging purposes. It can be used to copy ext2, ext3, and ext4 partitions efficiently by only copying the used blocks. Note that is only works for ext2, ext3, and ext4 filesystems, and the unused blocks are not copied so this may not be a useful tool if one is hoping to recover deleted files.<br />
<br />
To clone a partition from physical disk {{ic|/dev/sda}}, partition 1, to physical disk {{ic|/dev/sdb}}, partition 1 with e2image, run<br />
<br />
# e2image -ra -p /dev/sda1 /dev/sdb1<br />
<br />
{{Note|gparted uses e2image to efficiently copy ext2/3/4 partitions.}}<br />
<br />
== Disk cloning software ==<br />
<br />
These applications allow easy backup of entire filesystems and recovery in case of failure, usually in the form of a Live CD or USB drive. They contain complete system images from one or more specific points in time and are frequently used to record known good configurations.<br />
<br />
See also [[Synchronization and backup programs]] for other applications that can take full system snapshots, among other functionality.<br />
<br />
* {{App|[[wikipedia:Acronis_True_Image|Acronis True Image]]|Commercial disk cloner for Windows. It allows you to create a live (from within Windows), so you do not need a working Windows install on the actual machine to use it. After registration of the Acronis software on their website, you will be able to download a Linux-based Live CD and/or plugins for BartPE for creation of the Windows-based live CD. It can also create a WinPE Live CD based on Windows. The created ISO Live CD image by Acronis doesn't have the [http://www.syslinux.org/wiki/index.php/Isohybrid hybrid boot] ability and cannot be written to USB storage as a raw file.|http://www.acronis.com/products/trueimage/|}}<br />
<br />
* {{App|Arch Backup|A trivial backup script with simple configuration.<br />
** Configurable compression method.<br />
** Multiple backup targets.<br />
|https://github.com/p5n/archlinux-stuff/tree/master/arch-backup/|{{AUR|arch-backup}}}}<br />
<br />
* {{App|[[Wikipedia:Clonezilla|Clonezilla]]|A disaster recovery, disk cloning, disk imaging and deployment solution.<br />
** Boots from live CD, USB flash drive, or PXE server.<br />
** Supports ext2, ext3, ext4, reiserfs, reiser4, xfs, jfs, btrfs FAT32, NTFS, HFS+ and others.<br />
** Uses Partclone (default), Partimage (optional), ntfsclone (optional), or dd to image or clone a partition.<br />
** Multicasting server to restore to many machines at once.<br />
** Included on the Arch Linux installation media.<br />
|http://clonezilla.org/|{{Pkg|clonezilla}}}}<br />
<br />
* {{App|FSArchiver|A safe and flexible file-system backup and deployment tool<br />
** Support for basic file attributes (permissions, owner, ...).<br />
** Support for multiple file-systems per archive.<br />
** Support for extended attributes (they are used by SELinux).<br />
** Support the basic file-system attributes (label, uuid, block-size) for all linux file-systems.<br />
** Support for [http://www.fsarchiver.org/Cloning-ntfs ntfs filesystems] (ability to create flexible clones of a Windows partitions).<br />
** Checksumming of everything which is written in the archive (headers, data blocks, whole files).<br />
** Ability to restore an archive which is corrupt (it will just skip the current file).<br />
** Multi-threaded lzo, gzip, bzip2, lzma compression.<br />
** Support for splitting large archives into several files with a fixed maximum size.<br />
** Encryption of the archive using a password. Based on blowfish from libcrypto from [[OpenSSL]].<br />
** Support backup of a mounted root filesystem (-A option).<br />
** Can be found on the [http://www.sysresccd.org/Main_Page System Rescue CD].<br />
|http://www.fsarchiver.org/Main_Page|{{Pkg|fsarchiver}}}}<br />
<br />
* {{App|[[Wikipedia:Mondo Rescue|Mondo Rescue]]|A disaster recovery solution to create backup media that can be used to redeploy the damaged system.<br />
** Image-based backups, supporting Linux/Windows.<br />
** Compression rate is adjustable.<br />
** Can backup live systems (without having to halt it).<br />
** Can split image over many files.<br />
** Supports booting to a Live CD to perform a full restore.<br />
** Can backup/restore over NFS, from CDs, tape drives and and other media.<br />
** Can verify backups.<br />
|http://www.mondorescue.org/|{{AUR|mondo}}}}<br />
<br />
* {{App|[[Partclone]]|A tool that can be used to back up and restore a partition while considering only used blocks.<br />
** Supports ''ext2'', ''ext3'', ''ext4'', ''hfs+'', ''reiserfs'', ''reiser4'', ''btrfs'', ''vmfs3'', ''vmfs5'', ''xfs'', ''jfs'', ''ufs'', ''ntfs'', ''fat(12/16/32)'', ''exfat''.<br />
** Supports compression.<br />
** Optionally, an ''ncurses'' interface can be used.<br />
|http://partclone.org/|{{Pkg|partclone}}}}<br />
<br />
* {{App|PartedMagic|Live cd/usb with PartImage and other recovery tools.|3=http://partedmagic.com/doku.php?id=start|4=}}<br />
<br />
* {{App|[[Wikipedia:Partimage|Partimage]]|An ''ncurses'' disk cloning utility for Linux/UNIX environments.<br />
** Has a Live CD.<br />
** Supports the most popular filesystems on Linux, Windows and Mac OS.<br />
** Compression.<br />
** Saving to multiple CDs or DVDs or across a network using Samba/NFS.<br />
** Development stopped in favor of FSArchiver.<br />
|http://www.partimage.org/Main_Page|{{Pkg|partimage}}}}<br />
<br />
* {{App|Q7Z|P7Zip GUI for Linux, which attempts to simplify data compression and backup. It can create the following archive types: 7z, BZip2, Zip, GZip, Tar.<br />
** Updates existing archives quickly.<br />
** Backup multiple folders to a storage location.<br />
** Create or extract protected archives.<br />
** Lessen effort by using archiving profiles and lists.<br />
|http://k7z.sourceforge.net/|{{AUR|q7z}}}}<br />
<br />
* {{App|[[Wikipedia:Redo Backup and Recovery|Redo Backup and Recovery]]|A backup and disaster recovery application that runs from a bootable Linux CD image.<br />
** Is capable of bare-metal backup and recovery of disk partitions.<br />
** Uses [http://www.xpud.org/ xPUD] and [[Partclone]] for the backend.<br />
|http://www.redobackup.org/|}}<br />
<br />
* {{App|System Tar & Restore|Backup and Restore your system using tar or Transfer it with rsync<br />
** GUI and CLI interfaces<br />
** Creates ''.tar.gz'', ''.tar.bz2'', ''.tar.xz'' or ''.tar'' archives<br />
** Supports openssl / gpg encryption<br />
** Uses rsync to transfer a running system<br />
** Supports Grub2, Syslinux, EFISTUB/efibootmgr and Systemd/bootctl<br />
|https://github.com/tritonas00/system-tar-and-restore|{{AUR|system-tar-and-restore}}}}<br />
<br />
=== dd spin-offs ===<br />
<br />
Other ''dd''-like programs feature periodical status output, e.g. a simple progress bar.<br />
<br />
; dcfldd : {{Pkg|dcfldd}} is an enhanced version of dd with features useful for forensics and security. It accepts most of dd's parameters and includes status output. The last stable version of dcfldd was released on December 19, 2006.<sup>[http://dcfldd.sourceforge.net/]</sup><br />
<br />
; ddrescue : GNU {{Pkg|ddrescue}} is a data recovery tool. It is capable of ignoring read errors, which is a useless feature for disk wiping in almost any case. See the [http://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html official manual] for details.<br />
<br />
== See also ==<br />
<br />
* [[Wikipedia:List of disk cloning software]]<br />
* [https://bbs.archlinux.org/viewtopic.php?id=4329 Arch Linux forum thread]</div>Self-Perfectionhttps://wiki.archlinux.org/index.php?title=CUPS_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)/Printer_sharing_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)&diff=281912CUPS (Русский)/Printer sharing (Русский)2013-11-07T20:45:26Z<p>Self-Perfection: </p>
<hr />
<div>[[Category:Принтеры (Русский)]]<br />
[[Category:Русский]]<br />
[[en:CUPS printer sharing]]<br />
{{Article summary start|Описание}}<br />
{{Article summary text|Настройка общего доступа к принтерам с использованием CUPS}}<br />
{{Article summary heading|Полезные ссылки}}<br />
{{Article summary wiki|Samba}}<br />
{{Article summary wiki|CUPS}}<br />
{{Article summary end}}<br />
<br />
[[CUPS]] позволяет настроить возможность доступа к принтерам из различных систем. Далее будут приведены инструкции для типичных случаев.<br />
<br />
==Внутри систем GNU/Linux==<br />
В CUPS, с помощью веб-интерфейса, достаточно просто настроить сервер печати GNU/Linux на использование внутри системы GNU/Linux, хотя ручная настройка тоже возможна.<br />
<br />
===Использование веб-интерфейса===<br />
<br />
Для доступа к странице администрирования CUPS, откройте в браузере адрес: http://localhost:631. <br />
<br />
В верхней части находится вкладка ''Administration'' - кликните по ней, нажмите на кнопку добавления принтера, при этом будут автоматически определены подключенные принтеры. Если этого не произойдет, отключите принтер и подключите его снова. <br />
<br />
После создания принтера зайдите в раздел ''Server'' и установите флажок напротив "Share printers connected to this system". После клика по ''change settings'', сервер будет перезапущен автоматически. <br />
<br />
Для прямой правки файла {{ic|cups.conf}} выберите "Edit Configuration File". Это действие будет полезным для настройки доступа к серверу только отдельным пользователям или IP-адресам, примеры указаны ниже.<br />
<br />
===Ручная настройка===<br />
<br />
На сервере (тот, который управляет и подсоединён к принтеру) просто откройте файл {{ic|/etc/cups/cupsd.conf}} и разрешите доступ к серверу, изменив строчки с тэгом Location. Например:<br />
<Location /><br />
Order allow,deny<br />
Allow localhost<br />
Allow 192.168.0.*<br />
</Location><br />
<br />
Также убедитесь, что серверу для адресации доступен IP-адрес клиента. Добавьте следующие строки после "# Listen <serverip>:631" (192.168.0.100 - IP-адрес сервера, а не клиента):<br />
Listen 192.168.0.101:631<br />
<br />
Для отображения всех доступных принтеров локальной сети "Show shared printers on the local network", добавьте строку "BrowseAllow all":<br />
Browsing On<br />
BrowseOrder allow,deny<br />
BrowseAllow @LOCAL<br />
BrowseAllow all<br />
<br />
После внесения всех изменений, перезапустите CUPS:<br />
# /etc/rc.d/cupsd restart<br />
<br />
На стороне клиента откройте (создайте, если отсутствует) файл {{ic|/etc/cups/client.conf}} и укажите в ServerName соответствующее имя сервера или его IP-адрес. Добавьте эту строку:<br />
ServerName 192.168.0.100<br />
<br />
Для отображения всех доступных принтеров локальной сети "Show shared printers on the local network", добавьте строку "BrowseAllow all"<br />
Browsing On<br />
BrowseOrder allow,deny<br />
BrowseAllow @LOCAL<br />
BrowseAllow all<br />
<br />
Есть другие возможности для настройки, включая автоматическую, которые подробно описаны на http://localhost:631/help/network.html <!-- Someone with CUPS installed could rename the link to the page title --><br />
<br />
После внесения всех изменений, перезапустите CUPS.<br />
<br />
{{Note|При добавлении принтера с клиентского компьютера, если используется Internet Printing Protocol (IPP), в качестве URI укажите ipp://192.168.0.101:631/printers/<имя_нужного_принтера>}}<br />
<br />
====Using a CUPS 1.6.x client with a <= 1.5.x server====<br />
<br />
Начиная с CUPS версии 1.6, клиент по-умолчанию использует IPP 2.0. Если сервер использует CUPS <= 1.5 / IPP <= 1.1, клиент не понижает версию используемого протокола автоматически, и, таким образом, не может взаимодействовать с сервером. Обходной путь (недокументирован на 2013-05-07, но см. [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704238 упомянут в этом багрепорте]) добавить следующую строку в {{ic|/etc/cups/client.conf}}:<br />
ServerName HOSTNAME-OR-IP-ADDRESS[:PORT]/version=1.1<br />
<br />
==Между GNU/Linux и Windows==<br />
<br />
===Linux server - Windows client===<br />
<br />
====Общий доступ с помощью IPP====<br />
<br />
В качестве '''предпочтительного метода''', при подключении клиента Windows к серверу печати Linux, используется [http://de.wikipedia.org/wiki/Internet_Printing_Protocol IPP]. Это стандартный, основанный на HTTP, протокол принтера, который позволяет использовать преимущества переадресации портов, туннелирования и т.д.<br />
Конфигурация '''очень проста''' и, таким образом, в сравнении с использованием Samba, меньше подвержена ошибкам.<br />
ОС Windows имеет встроенную поддержку IPP только '''начиная с Windows 2000'''.<br />
<br />
В предыдущем разделе описаны настройки сервера для возможности обзора.<br />
<br />
На компьютере с Windows, перейдите к панели управления принтера и выберите 'Add a New Printer' ('Добавить новый принтер'). Далее, укажите URL. В качестве URL, тип и местоположение принтера: http://host_ip_address:631/printers/printer_name (где host_ip_address - IP-адрес сервера GNU/Linux, а printer_name - имя подключенного к нему принтрера).<br />
<br />
Затем на компьютере с Windows установите родные драйвера принтера. Если на сервере CUPS используются собственные драйвера на принтер, то для клиента Windows можно выбрать generic postscript-принтер (например 'HP Color LaserJet 8500 PS' или 'Xerox DocuTech 135 PS2'). Для проверки правильности настроек - распечатайте пробную страницу.<br />
<br />
====Общий доступ с помощью Samba====<br />
<br />
Если версия ОС Windows ниже Windows 2000, или при использовании IPP возникают проблемы, можно настроить общий доступ с помощью Samba.<br />
Учитывайте, что при использовании Samba будет задействовано дополнительное программное обеспечение. Поэтому данный способ '''сложнее в настройке''', также могут возникнуть '''дополнительные проблемы''', связанные, в основном, с аутентификацией.<br />
<br />
Для настройки Samba на сервере Linux, отредактируйте файл {{ic|/etc/samba/smb.conf}}, это даст возможность предоставить общий доступ к принтерам. Файл {{ic|smb.conf}} может содержать примерно следующее:<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
workgroup=Heroes<br />
server string=Arch Linux Print Server<br />
security=user<br />
<br />
[printers]<br />
comment=All Printers<br />
path=/var/spool/samba<br />
browseable=yes<br />
# to allow user 'guest account' to print.<br />
guest ok=no<br />
writable=no<br />
printable=yes<br />
create mode=0700<br />
write list=@adm root yourusername<br />
}}<br />
<br />
Этого должно быть достаточно для организации совместного доступа, но все-таки рекомендуется добавить для принтера отдельную запись:<br />
{{hc|/etc/samba/smb.conf|2=<br />
[ML1250]<br />
comment=Samsung ML-1250 Laser Printer<br />
printer=ml1250<br />
path=/var/spool/samba<br />
printing=cups<br />
printable=yes<br />
printer admin=@admin root yourusername<br />
user client driver=yes<br />
# to allow user 'guest account' to print.<br />
guest ok=no<br />
writable=no<br />
write list=@adm root yourusername<br />
valid users=@adm root yourusername<br />
}}<br />
<br />
Учтите, что при таких настройках, должна существовать учетная запись с правами доступа к принтеру. Для публичного принтера установите ''guest ok'' в ''yes'', и удалите строку ''valid users''. Для добавления учетных записей, создайте действующую учетную запись GNU/Linux, а затем установите на Samba-сервере пароль. Например:<br />
# useradd yourusername<br />
# smbpasswd -a yourusername<br />
<br />
<!--<br />
После настройки учётных записей для пользователей вам нужно будет настроить каталог спулинга для samba:<br />
{{bc|<br />
# mkdir /var/spool/samba<br />
# chmod 777 /var/spool/samba<br />
}}<br />
<br />
Следующие файлы, которые предстоит отредактировать - {{ic|/etc/cups/mime.convs}} и {{ic|/etc/cups/mime.types}}:<br />
<br />
{{ic|mime.convs}}:<br />
{{bc|<br />
# The following line is found at near the end of the file. Uncomment it.<br />
application/octet-stream application/vnd.cups-raw 0 -<br />
}}<br />
<br />
{{ic|mime.types}}:<br />
{{bc|<br />
# Again near the end of the file.<br />
application/octet-stream<br />
}}<br />
<br />
Изменения в {{ic|mime.convs}} и {{ic|mime.types}} необходимы для того чтобы CUPS мог печатать документы Microsoft Office. Многим людям это требуется.<br />
--><br />
<br />
Затем перезапустите демон Samba:<br />
# /etc/rc.d/samba restart<br />
<br />
Естественно, имеется множество дополнительных настроек сервера печати Samba, поэтому, для получения дополнительной информации, следует обратиться к справочной документации Samba и CUPS. Образцы и примеры можно посмотреть в файле {{ic|smb.conf.example}}.<br />
<br />
<br />
===Windows server - Linux client===<br />
<br />
====Общий доступ с помощью LPD====<br />
<br />
Поскольку в Windows 7 имеется интегрированный LPD-сервер, то, возможно, будет намного проще использовать именно его, поскольку не придется для клиента устанавливать ''Samba'', а на сервере - можно будет обойтись без сложных настроек.<br />
<br />
Затем, принтер можно будет добавить в CUPS просто выбрав протокол LPD. Адресс принтера будет выглядеть следующим образом:<br />
<br />
# lpd://windowspc/printersharename<br />
<br />
Перед добавлением вам, скорее всего, понадобиться установить для своей модели принтера соответствующий драйвер. Драйвера Generic PostScript или RAW тоже должны работать.<br />
<br />
====Общий доступ с помощью IPP====<br />
<br />
Как и в предыдущем случае, для организации общего доступа к принтерам протокол IPP является '''предпочтительным'''. Но, так как потребуется приложить немного больше усилий в сравнении с использованием Samba, метод создания IPP-Сервера в Windows может оказаться '''более сложным'''.<br />
Обычно выбирают программное обеспечение от Microsoft's Internet Information Services (IIS).<br />
<br />
{{Note|Этот раздел является неполным. Более подробное описание по настройке ISS для Windows XP и Windows 2000, можно найти на немецком (к сожалению) [http://www.heise.de/netze/artikel/Ueberall-drucken-221652.html]}}<br />
<br />
====Общий доступ с помощью Samba====<br />
<br />
'''Гораздо проще''' использовать стандартные возможности Windows по предоставлению общего доступа к принтерам с помощью Samba. Ручная настройка практически не требуется и все можно выполнить через CUPS Backend. Однако, как было замечено выше, в Windows могут возникнуть проблемы с аутентификацией и ограничением доступа.<br />
<br />
На стороне сервера необходимо разрешить общий доступ к принтеру и убедится, что клиентские машины имеют к этому принтеру доступ.<br />
<br />
В следующем разделе будут описаны настройки клиента с обоими (cupsd и smbd) запущенными демонами.<br />
<br />
=====Использование веб-интерфейса=====<br />
<br />
Backend Samba CUPS должен быть запущен по умолчанию, но если этого не происходит - введите следующую команду и перезапустите CUPS.<br />
# ln -s $(which smbspool) /usr/lib/cups/backend/smb<br />
<br />
Затем, просто зайдите в веб-интерфейс CUPS и добавьте новый принтер. В качестве устройства выберите "Windows Printer via SAMBA".<br />
<br />
Для местоположения устройства, выберите:<br />
smb://username:password@hostname/имя_принтера<br />
<br />
Или, если пароля нет:<br />
smb://username@hostname/имя_принтера<br />
<br />
Убедитесь, что пользователь действительно имеет доступ к принтеру на компьютере Windows, и выберите соответствующие драйверы. Если компьютер находится в домене, убедитесь, что в имени пользователя присутствует домен: <br />
smb://username:password@domain/hostname/имя_принтера<br />
<br />
Если в сети доступно много принтеров, то можно выбрать предпочитаемый. Для этого войдите в веб-интерфейс, перейдите на вкладку Принтеры, выберите нужный принтер и, в выпадающем списке, установите 'Set as default' ('Использовать по умолчанию').<br />
<br />
=====Ручная настройка=====<br />
<br />
При ручной настройке: остановите демон CUPS и добавьте свой принтер в {{ic|/etc/cups/printers.conf}}, который, к примеру, может выглядеть так:<br />
<br />
{{hc|/etc/cups/printers.conf|2=<br />
<DefaultPrinter MyPrinter><br />
AuthInfoRequired username,password<br />
Info My printer via SAMBA<br />
Location In my Office<br />
MakeModel Samsung ML-1250 - CUPS+Gutenprint v5.2.7 # <= для получения списка доступных моделей запустить 'lpinfo -m'<br />
DeviceURI smb://username:password@hostname/printer_name # <= URI сервера, выбирать согласно описания в предыдущем разделе<br />
State Idle<br />
Type 4<br />
Accepting Yes<br />
Shared No<br />
JobSheets none none<br />
QuotaPeriod 0<br />
PageLimit 0<br />
KLimit 0<br />
AllowUser yourusername # <= не забудьте изменить это<br />
OpPolicy default<br />
ErrorPolicy stop-printer<br />
</Printer><br />
}}<br />
<br />
Перезапустите демон CUPS и распечатайте тестовую страницу.<br />
<br />
Для установки предпочтительного принтера используйте следующую команду:<br />
# lpoptions -d имя_принтера_используемого_по_умолчанию<br />
<br />
===Устранение неполадок===<br />
<br />
Если возникают какие-либо проблемы, первое, что нужно сделать - это включить отладочную информацию, для этого в {{ic|/etc/cups/cupsd.conf}} установите:<br />
{{bc|LogLevel debug}}<br />
<br />
Затем перезапустите демон CUPS и в файле {{ic|/var/log/cups/error_log}} проверьте сообщения об ошибках. Удобнее просматривать так:<br />
# tail -f /var/log/cups/error_log<br />
будут выведены сообщения о появившихся ошибках.<br />
<br />
Note: Для изучения файла ошибок также можно воспользоваться веб-интерфейсом.<br />
<br />
==Другие операционные системы==<br />
Более подробную информацию о взаимодействии CUPS с другими системами печати можно найти в руководстве CUPS, например, на http://localhost:631/sam.html#PRINTING_OTHER</div>Self-Perfectionhttps://wiki.archlinux.org/index.php?title=Sshguard&diff=247186Sshguard2013-02-13T15:15:16Z<p>Self-Perfection: </p>
<hr />
<div>[[Category:Secure Shell]]<br />
[[es:Sshguard]]<br />
{{warning|Using an IP blacklist will stop trivial attacks but it relies on an additional daemon and successful logging (the partition containing /var can become full, especially if an attacker is pounding on the server). Additionally, if the attacker knows your IP address, they can send packets with a spoofed source header and get you locked out of the server. [[SSH keys]] provide an elegant solution to the problem of brute forcing without these problems.}}<br />
[http://www.sshguard.net sshguard] is a daemon that protects [[SSH]] and other services against brute-force attacts, similar to [[fail2ban]].<br />
<br />
sshguard is different from the other two in that it is written in C, is lighter and simpler to use with fewer features while performing its core function equally well.<br />
<br />
sshguard is not vulnerable to most (or maybe any) of the log analysis [http://www.ossec.net/main/attacking-log-analysis-tools vulnerabilities] that have caused problems for similar tools.<br />
<br />
==Installation==<br />
Install {{Pkg|sshguard}} from the [[official repositories]].<br />
<br />
==Configuration==<br />
The main configuration required is creating a chain named "sshguard" in the INPUT chain of iptables where sshguard automatically inserts rules to drop packets coming from bad hosts:<br />
# iptables -N sshguard<br />
# iptables -A INPUT -j sshguard<br />
# /etc/rc.d/iptables save<br />
<br />
If you do not currently use iptables and just want to get sshguard up and running without any further impact on your system, these commands will create and save an iptables configuration that does absolutely nothing except allowing sshguard to work:<br />
# iptables -F<br />
# iptables -X<br />
# iptables -P INPUT ACCEPT<br />
# iptables -P FORWARD ACCEPT<br />
# iptables -P OUTPUT ACCEPT<br />
# iptables -N sshguard<br />
# iptables -A INPUT -j sshguard <br />
# iptables-save > /etc/iptables/iptables.rules <br />
<br />
To finish saving your iptables configuration.<br />
<br />
For more information on using iptables to create powerful firewalls, see [[Simple Stateful Firewall]].<br />
<br />
Then, enable the service:<br />
# systemctl enable sshguard<br />
<br />
===In Arch Linux===<br />
{{out of date|systemd sshguard.service relies on logging to systemd journal and ignores /var/log/auth.log}}<br />
By default, sshguard does not have its own configuration file: all options are supplied on the command line. However, Arch Linux uses the {{ic|/etc/conf.d/sshguard}} configuration file, allowing additional arguments to be passed to the command line when sshguard is started.<br />
By default sshguard will use its built-in log reader, called ''Log Sucker'', to read the logs:<br />
/usr/sbin/sshguard -l /var/log/auth.log -b /var/db/sshguard/blacklist.db<br />
<br />
The {{ic|-l}} switch tells sshguard which log to watch. Note also the {{ic|-b}} option is used, which makes some bans permanent. Records of permanent bans are then kept in {{ic|/var/db/sshguard/blacklist.db}} to be remembered between restarts.<br />
<br />
==General Information==<br />
sshguard works by watching {{ic|/var/log/auth.log}} for changes to see if someone is failing to log in too many times. It can also be configured to get this information straight from syslog-ng. After too many login failures (default 4) the offending host is banned from further communication for a limited amount of time. The amount of time the offender is banned starts at 7 minutes and doubles each time he is banned again. By default in the archlinux package, at one point offenders become permanently banned.<br />
<br />
Bans are done by adding an entry into the "sshguard" chain in iptables that drops all packets from the offender. To make the ban only affect port 22, simply do not send packets going to other ports through the "sshguard" chain.<br />
<br />
When sshguard bans someone, the ban is logged to syslog and ends up in {{ic|/var/log/auth.log}}.<br />
<br />
==See also==<br />
*[[fail2ban]]</div>Self-Perfectionhttps://wiki.archlinux.org/index.php?title=General_purpose_mouse&diff=134600General purpose mouse2011-03-23T18:43:06Z<p>Self-Perfection: </p>
<hr />
<div>[[Category:Daemons and system services (English)]]<br />
[[Category:Other desktop user's resources (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:Mice (English)]]<br />
{{i18n|Console Mouse Support}}<br />
<br />
{{Article summary start|Summary}}<br />
{{Article summary text|Installing and enabling the GPM daemon.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Daemon}}<br />
{{Article summary end}} __NOEDITSECTION__<br />
<br />
GPM, short for General Purpose Mouse, is a daemon that provides mouse support for Linux virtual consoles. It is included in most Linux distributions.<br />
<br />
==Installing==<br />
===Desktop===<br />
Install {{package Official|gpm}} with [[pacman]]:<br />
# pacman -S gpm<br />
===Laptop===<br />
Install {{package Official|gpm}} and {{package Official|xf86-input-synaptics}} with [[pacman]]:<br />
# pacman -S gpm xf86-input-synaptics<br />
<br />
==Configuring==<br />
The {{Codeline|-m}} parameter precedes the declaration of the mouse to be used. The {{Codeline|-t}} parameter precedes the type of mouse. To get a list of available types for the {{Codeline|-t}} option, run gpm with {{Codeline|-t help}}.<br />
$ gpm -m /dev/input/mice -t help<br />
<br />
If the mouse only has 2 buttons, pass {{Codeline|-2}} to {{Codeline|GPM_ARGS}} and button-2 will preform the paste function.<br />
<br />
The gpm package needs to be started with a few parameters. These parameters can be added in the file {{Filename|/etc/conf.d/gpm}} or used when running gpm directly.<br />
* For PS/2 mice, replace the existing line with:<br />
GPM_ARGS="-m /dev/psaux -t ps2"<br />
* Whereas USB mice should use:<br />
GPM_ARGS="-m /dev/input/mice -t imps2"<br />
* And IBM Trackpoints need:<br />
GPM_ARGS="-m /dev/input/mice -t ps2"<br />
<br />
Once a suitable configuration has been found, adding {{Codeline|gpm}} into the {{codeline|DAEMONS}} array in {{Filename|/etc/rc.conf}} will make {{Codeline|gpm}} load at boot. Example:<br />
DAEMONS=(syslog-ng '''gpm''' network netfs crond)<br />
<br />
For more information see {{Codeline|man gpm}}.</div>Self-Perfectionhttps://wiki.archlinux.org/index.php?title=Keyboard_input&diff=68469Keyboard input2009-05-09T11:10:11Z<p>Self-Perfection: /* Introduction */</p>
<hr />
<div>[[Category:Input devices (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
= Introduction =<br />
Many keyboards include some "special keys" (also called hotkeys), which are supposed to execute an application or print special characters (not included in the standard national keymaps). The lack of specification for these extra keys makes it impossible for the kernel to know what to do with them and that's why we need to map the keys to actions. There are two ways of doing that:<br />
*The universal way using [[HAL]] and [[Xorg]] utilities (and eventually your desktop environment tools)<br />
*The quicker way using a third-party program to do everything in GUI<br />
<br />
Contrary to what you may think the first method is preferred as [[HAL]] and [[Xorg]] are more universal than any third-party program could ever claim to be.<br />
<br />
<br />
<br />
'''If you don't have time''' and just want the keys to work there are 2 cases:<br />
*You use Gnome:<br />
Everything can be done from the Control Center.<br />
*You use KDE or an other environment that doesn't support kernel-level extra keys detection:<br />
Use a third-party program, such as [[keytouch]] or [[xbindkeys]].<br />
<br />
=The Arch way=<br />
==Preface==<br />
Before starting you need to learn some vocabulary ...<br />
<br />
A '''scancode''' is the lowest identification number for a key. If a key doesn't have a scancode then we can't do anything because it means that the kernel doesn't see it.<br />
<br />
A '''keycode''' is the second level of identification for a key, a keycode corresponds to a function.<br />
<br />
A '''symbol''' is the third level of identification for a key, it is the way Xorg refers to keys.<br />
<br />
==Step 1: Map scancodes==<br />
If you use [[HAL]] the most part of your keys should already have a keycode. If not, think about helping the community by expanding the database.<br />
<br />
===The diagnosis===<br />
====Using showkey====<br />
The universal way to know if a key has a keycode is to use the kernel <code>showkey</code> program. showkey waits for a key to be pressed and if none is during 10 seconds it quits, note that this is the only way to exit the program. To execute showkey you need to be in a real console, it means not in a graphical environment so '''switch using Ctrl+Alt+F1'''.<br />
$ showkey<br />
and try to push your hotkeys. If a keycode appears the key is mapped, if not it can mean either that the kernel doesn't see the key or that the key is not mapped.<br />
<br />
====Using xev====<br />
Another way to get the keycodes of your keys is to use the graphical X program "xev" (without having to switch to a console environment). With the following line you can start xev and directly grep the important parts:<br />
$ xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'<br />
In the example below I pressed the "a", "r", "c" and "h" keys and two of the media keys on my Dell keyboard. This gives me the following output:<br />
38 a<br />
27 r<br />
54 c<br />
43 h<br />
153 NoSymbol<br />
144 NoSymbol<br />
This means that the "a", "r", "c" and "h" keys have the keycodes 38, 27, 54 and 43 and are properly bound while the media keys with the keycodes 153 and 144 have no function yet, which is indicated by "NoSymbol". If you press a key and nothing appears in the terminal, this means that the kernel doesn't see that key or that it is not mapped.<br />
<br />
====Conclusion====<br />
If all your keys have a keycode you can go directly to the second step.<br />
<br />
If not keep reading below:<br />
<br />
===Know if a key has a scancode===<br />
If a key doesn't have a keycode you can know if it has a scancode by looking at the kernel log using the dmesg command:<br />
$ dmesg|tail -5<br />
If when you press the key something like that appears:<br />
atkbd.c: Unknown key pressed (translated set 2, code 0xf1 on isa0060/serio0).<br />
atkbd.c: Use 'setkeycodes e071 <keycode>' to make it known.<br />
then your key has a scancode which can be mapped to a keycode. See [[Map scancodes to keycodes]].<br />
<br />
If nothing new appears in dmesg then your key doesn't have a scancode which means that it is not recognized by the kernel so it cannot be used.<br />
<br />
===Map scancodes to keycodes===<br />
''See the detailed article: [[Map scancodes to keycodes]].''<br />
<br />
==Step 2: Map keycodes==<br />
===In Console===<br />
When we are in console, we can use our hotkeys to print a certain character. Moreover we can also print a sequence of characters and some escape sequences. Thus, if we print the sequence of characters constituting a command and afterwards an escape character for a new line, that command will be executed!<br />
<br />
''See the detailed article: [[Extra Keyboard Keys in Console]].''<br />
<br />
===In Xorg===<br />
When we are in a graphical environment we may want a key to print a special character or execute a command. There are many ways of doing that and they are covered in a dedicated article: [[Extra Keyboard Keys in Xorg]].<br />
<br />
=The quick way=<br />
==In Gnome==<br />
If you use Gnome everything can be done from the Control Center. However if you decide to change for another Desktop Environment you'll have to re-configure your keys.<br />
<br />
==In other desktops environments==<br />
In desktop environments that can't read scancodes and/or keycodes you can use one of the following third-party softwares:<br />
<br />
===keytouch===<br />
KeyTouch is a program which allows you to easily configure the extra function keys of your keyboard. This means that you can define, for every individual function key, what to do if it is pressed.<br />
<br />
''See the detailed article: [[keytouch]].''<br />
<br />
===lineak===<br />
{{Box Note |Lineak is not really an active project. If you really want to use a third-party program you are encouraged to use [[keytouch]] instead.}}<br />
Lineak is a utility designed to enable the use and configuration of internet, easy access and multimedia keys.<br />
<br />
=Laptops=<br />
==Asus M series==<br />
I think it'll be work in another series with Asus product of laptops. How to make work multimedia keys on Arch? And disable light sensor? It's very simple, login as root, edit:<br />
$ /etc/rc.local<br />
add only one line:<br />
$ echo 0 > /sys/devices/platform/asus-laptop/ls_switch<br />
It's all, regads.<br />
''See the detailed article: [[lineak]].''</div>Self-Perfection