
Установка kpcli в Unix/Linux
kpcli — это консольный keepass. По функциональности, ни чем не отличается от использования графического интерфейса.
Установка kpcli на Mac OS X
Для начала, установим — homebrew, для этого у меня имеется статья:
Установка homebrew на Mac OS X
И выполняем установку:
$ brew install kpcli
Установка на mac очень простая.
Установка kpcli на Debian/Ubuntu
# apt-get install kpcli
Установка kpcli на CentOS/RedHat/Fedora
# yum install kpcli
Использование kpcli в Unix/Linux
И так, я привел пример установки данной утилиты, только на Mac OS X т.к не было необходимости использовать другие ОС.
Для начала, вызываем помощь:
$ kpcli -h Usage: kpcli [--kdb=<file.kdb>] [--key=<file.key>] --kdb Optional KeePass database file to open (must exist). --key Optional KeePass key file (must exist). --pwfiles Read master password from file instead of console. --histfile Specify your history file (or perhaps /dev/null). --readonly Run in read-only mode; no changes will be allowed. --timeout=i Lock interface after i seconds of inactivity. --command Run single command and exit (no interactive session). --no-recycle Don't store entry changes in /Backup or "/Recycle Bin". --help This message. Run kpcli with no options and type 'help' at its command prompt to learn about kpcli's commands.
Для запуска, используйте:
$ kpcli
Создаем базу и устанавливаем на нее пароль:
kpcli:/> saveas mypasswords.kdb Please provide the master password: ************************* Retype to verify: ************************* kpcli:/>
БД создасться в текушей директории.
Или, можно указать путь, где будет хранится БД:
kpcli:/> saveas /Users/captain/Projects/mypasswords.kdb Please provide the master password: ************************* Retype to verify: ************************* kpcli:/>
И так, БД готова. Установили на ее пароль, теперь создаем папку (я обычно все группирую):
kpcli:/> mkdir test_dir Database was modified. Do you want to save it now? [y/N]: Saved to /Users/captain/Projects/mypasswords.kdb kpcli:/> ls === Groups === eMail/ Internet/ test_dir/ kpcli:/>
Создание записей
Создадим запись:
kpcli:/test_dir> cd test_dir/ Invalid path kpcli:/test_dir> new Adding new entry to "/test_dir" Title: linux-notes.org Username: test_user Password: ("g" or "w" to auto-generate, "i" for interactive) Retype to verify: URL: http://linux-notes.org/ Notes/Comments (""): (end multi-line input with a single "." on a line) | Database was modified. Do you want to save it now? [y/N]: Saved to /Users/captain/Projects/mypasswords.kdb kpcli:/test_dir>
Вроде бы, тут все логично и понятно.
Вызвать помошь
Смотрим хелп:
kpcli:/> help attach -- Manage attachments: attach <path to entry|entry number> cd -- Change directory (path to a group) cl -- Change directory and list entries (cd+ls) clone -- Clone an entry: clone <path to entry> <path to new entry> close -- Close the currently opened database cls -- Clear screen ("clear" command also works) copy -- Copy an entry: copy <path to entry> <path to new entry> edit -- Edit an entry: edit <path to entry|entry number> export -- Export entries to a new KeePass DB (export <file.kdb> [<file.key>]) find -- Finds entries by Title help -- Print helpful information history -- Prints the command history icons -- Change group or entry icons in the database import -- Import a password database (import <file> <path> [<file.key>]) ls -- Lists items in the pwd or specified paths ("dir" also works) mkdir -- Create a new group (mkdir <group_name>) mv -- Move an item: mv <path to a group|or entries> <path to group> new -- Create a new entry: new <optional path&|title> open -- Open a KeePass database file (open <file.kdb> [<file.key>]) purge -- Purges entries in a given group base on criteria. pwck -- Check password quality: pwck <entry|group> pwd -- Print the current working directory quit -- Quit this program (EOF and exit also work) rename -- Rename a group: rename <path to group> rm -- Remove an entry: rm <path to entry|entry number> rmdir -- Delete a group (rmdir <group_name>) save -- Save the database to disk saveas -- Save to a specific filename (saveas <file.kdb> [<file.key>]) show -- Show an entry: show [-f] [-a] <entry path|entry number> stats -- Prints statistics about the open KeePass file ver -- Print the version of this program vers -- Same as "ver -v" xp -- Copy password to clipboard: xp <entry path|number> xu -- Copy username to clipboard: xu <entry path|number> xw -- Copy URL (www) to clipboard: xw <entry path|number> xx -- Clear the clipboard: xx Type "help <command>" for more detailed help on a command. kpcli:/>
Просмотр структуры
Для просмотра структуры, можно использовать:
kpcli:/> ls === Groups === General/ kpcli:/> ls General/ === Groups === Wide character in print at /usr/local/Cellar/kpcli/3.1_1/libexec/kpcli line 3645. Domains.Hosting/ eMail/ Homebanking/ Internet/ Job/ Market/ Messengers/ Network/ SEO/ Study/ Windows/ Соц.Сети/ kpcli:/>
Удалить папку.
Чтобы удалить папку внутри структуры, используйте:
kpcli:/> ls === Groups === eMail/ Internet/ test_dir/ Backup/ kpcli:/> rmdir test_dir Database was modified. Do you want to save it now? [y/N]: Saved to mypasswords.kdb kpcli:/> ls === Groups === eMail/ Internet/ Backup/ kpcli:/>
Переименовать группу
Команда:
kpcli:/> ls === Groups === eMail/ Internet/ Backup/ kpcli:/> rename eMail Enter the groups new Title: email Database was modified. Do you want to save it now? [y/N]: Saved to mypasswords.kdb kpcli:/> ls === Groups === email/ Internet/ Backup/ kpcli:/>
Просмотр сохраненного пароля из записей.
kpcli:/test_dir> show 0
Получаем:
Чтобы просмотреть пароль, можно вызвать «show» с опцией «-f»:
kpcli:/test_dir> ls === Entries === 0. linux-notes.org linux-notes.org kpcli:/test_dir> show -f 0 Title: linux-notes.org Uname: test_user Pass: testpassword URL: http://linux-notes.org/ Notes: kpcli:/test_dir>
Изменить запись
Можно так же изменить запись, для этого используем:
kpcli:/test_dir> ls === Entries === 0. linux-notes.org linux-notes.org kpcli:/test_dir> edit 0 Title: linux-notes.org_edited Username: test_user Password: ("g" or "w" to auto-generate, "i" for interactive) URL: http://linux-notes.org Notes/Comments (""): (end multi-line input with a single "." on a line) | Database was modified. Do you want to save it now? [y/N]: Saved to /Users/captain/Projects/mypasswords.kdb kpcli:/test_dir>
Удалить запись
Можно удалить запись, для этого используем:
kpcli:/test_dir> ls === Entries === 0. linux-notes.org_edited linux-notes.org kpcli:/test_dir> rm 0 Database was modified. Do you want to save it now? [y/N]: Saved to mypasswords.kdb kpcli:/test_dir> ls kpcli:/test_dir>
Поиск записей
Очень удобная утилита, которая позволяет искать записи, для этого выполните:
kpcli:/test_dir> find linux Searching for "linux" ... - 1 matches found and placed into /_found/ Would you like to show this entry? [y/N] Path: /test_dir/ Title: linux-notes.org_edited Uname: test_user Pass: ********* URL: http://linux-notes.org Notes: kpcli:/test_dir>
Выход из программы
Чтобы завершить работу, выполниет:
kpcli:/test_dir> quit
или
kpcli:/test_dir> exit
Открыть готовую базу с записями
Чтобы открыть существующий файл, выполняем:
$ kpcli --kdb My_Pass.kdbx Please provide the master password: ************************* KeePass CLI (kpcli) v3.1 is ready for operation. Type 'help' for a description of available commands. Type 'help <command>' for details on individual commands. kpcli:/>
Вас попросят ввести пароль, после чего — вы попадаете в меню утилиты.
Вот и все, статья «Установка kpcli в Unix/Linux» завершена.