View previous topic :: View next topic |
Author |
Message |
Dirk_G Tux's lil' helper
Joined: 09 Nov 2003 Posts: 144 Location: Wallerfangen
|
Posted: Sun Sep 04, 2005 10:15 am Post subject: wie codiert shadow? [solved] |
|
|
Hi
Hab mir ein Bash-Scritp geschrieben um automatisch einen Benutzter anzulegen. Das geht auch soweit, nur das Password macht Probleme. Useradd will das Password nicht als Klartext sondern schon codiert! Jetzt hab ich pwcrypt gefunden aber die Passwörter stimmen nicht mit denen in der shadow überein. Leider finde ich nicht wo steht wie shadow die Passwörter codiert. Hab gelesen das es beim compilieren gesetzt werden muss, nur wie man es ändert weis ich nicht.
Weis einer wie shadow codiert oder kennt einer eine andere Möglichkeit das Password für die shadow zu erstellen?
dirk
Last edited by Dirk_G on Sun Sep 04, 2005 12:00 pm; edited 1 time in total |
|
Back to top |
|
|
JonSnow n00b
Joined: 06 Nov 2004 Posts: 40 Location: Hannover - Germany
|
Posted: Sun Sep 04, 2005 10:34 am Post subject: |
|
|
man 5 shadow
|
|
Back to top |
|
|
Dirk_G Tux's lil' helper
Joined: 09 Nov 2003 Posts: 144 Location: Wallerfangen
|
Posted: Sun Sep 04, 2005 11:03 am Post subject: |
|
|
Danke für die schlaue Antwort. Aber dort steht weder drin wie das Passwort codiert wird noch wo man dieses ändern könnte, zumindest bei mir nicht. Kannst ja mal bei dir nachsehen und die stelle hier posten...
Dirk |
|
Back to top |
|
|
chrib Guru
Joined: 27 Sep 2003 Posts: 558 Location: Berlin, Germany
|
Posted: Sun Sep 04, 2005 11:29 am Post subject: |
|
|
Also bei mir steht da folgendes drin:
Code: | The password field must be filled. The encrypted password consists of 13 to 24 characters from the 64 characters alphabet a thru z, A thru Z, 0 thru 9, \. and /. Optionally it can start with a "$" character. This means the encrypted password was generated using another (not DES) algorithm. For example if it starts with "$1$" it means the MD5-based algorithm was used.
Refer to crypt(3) for details on how this string is interpreted. |
Demnach wird das Passwort normalerweise mit dem DES-Algorhythmus verschlüsselt, es sei denn es beginnt mit einem $.
HTH
Christian _________________ Der Mensch kämpft um zu überleben, und nicht, um zu Grunde zu gehen. - Paulo Coelho
It is the end of all hope. To lose the child, the faith. To end all the innocence. To be someone like me. - Nightwish - End of all hope |
|
Back to top |
|
|
Dirk_G Tux's lil' helper
Joined: 09 Nov 2003 Posts: 144 Location: Wallerfangen
|
Posted: Sun Sep 04, 2005 11:59 am Post subject: |
|
|
Ok, dann entschuldige ich mich für die schroffe Antwort.
Aber bei mir steht nur das...
The password field must be filled. The encryped password consists of 13
to 24 characters from the 64 character alphabet a thru z, A thru Z, 0
thru 9, interpreted.
Hab es noch einmal mit pwcrypt versucht und konnte mich doch anmelden! Komisch finde ich dass das codierte Password anders ist als wenn ich über passwd das Passwort änder! Na ja, egal. Hauptsache es geht!
Dirk |
|
Back to top |
|
|
STiGMaTa_ch Veteran
Joined: 28 Dec 2004 Posts: 1686 Location: Rüti ZH / Schweiz
|
Posted: Sun Sep 04, 2005 2:24 pm Post subject: |
|
|
Dirk_G wrote: | Komisch finde ich dass das codierte Password anders ist als wenn ich über passwd das Passwort änder! |
Was heisst heisst für dich anders? vom Format her? Oder meinst du, dass z.b. bei passwd aaaaa als codiertes passwort, bei pwcrypt bbbbb als codiertes passwort dasteht? Wenn es das ist, was dich beunruhigt, kannich dir entwarnung geben. Wenn du mit passwd 10x das passwort STiGMaTa für deinen account setzt, dann hast du auch 10x ein anderes codiertes resultat drinn.
Lieber Gruss
STiGMaTa |
|
Back to top |
|
|
SinoTech Advocate
Joined: 20 Mar 2004 Posts: 2579 Location: Neunkirchen / Saarland / Germany
|
Posted: Sun Sep 04, 2005 2:42 pm Post subject: |
|
|
Und für solche Zwecke kann man auch gut "chpasswd" benutzen.
man chpasswd wrote: |
chpasswd reads a list of user name and password pairs from standard
input and uses this information to update a group of existing users.
Each line is of the format:
user_name:password
By default the supplied password must be in clear-text. Default encrip-
tion algoritm is DES. Also the password age will be updated, if
present.
|
Ein Script zum anlegen eines Users könnte dann so aussehen:
Code: |
#!/bin/bash
#
# Adds a new user
# Read in username and password
echo "Username : "
read USERNAME
echo "Passwort : "
read PASSWORD
# Create user and puts them to the "users" group
useradd ${USERNAME} -g users
# Set password for the newly created user
chpasswd <<< "${USERNAME}:${PASSWORD}"
|
|
|
Back to top |
|
|
|