Portál AbcLinuxu, 10. května 2025 05:48

Dotaz: python a spwd

2.6.2009 12:42 summer
python a spwd
Přečteno: 176×
Odpovědět | Admin

Ahoj, mam skript, v ktorom chcem pomocou funkcie getspnam() ziskat z /etc/shadow heslo konkretneho usera, no po spusteni skriptu mi vyhodi KeyError: 'getspnam(): name not found' balicek spwd mam importovany.

Nástroje: Začni sledovat (0) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

2.6.2009 15:58 12345 | skóre: 41 | blog:
Rozbalit Rozbalit vše Re: python a spwd
Odpovědět | | Sbalit | Link | Blokovat | Admin
$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import spwd
>>> print spwd.__doc__
This module provides access to the Unix shadow password database.
It is available on various Unix versions.

Shadow password database entries are reported as 9-tuples of type struct_spwd,
containing the following items from the password database (see `<shadow.h>'):
sp_namp, sp_pwdp, sp_lstchg, sp_min, sp_max, sp_warn, sp_inact, sp_expire, sp_flag.
The sp_namp and sp_pwdp are strings, the rest are integers.
An exception is raised if the entry asked for cannot be found.
You have to be root to be able to use this module.

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.