[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: samba Probleme



Am Montag, den 23. Februar hub Olaf Ronneberger folgendes in die Tasten:

> Erst mal vielen Dank für die prompte Reaktion. Ja, ich hab sowohl die 
> von Deinem Server als auch die vom Skolelinux-Server (hieß so ähnlich 
> wie woody-test oder so) erfolglos ausprobiert

Du hattest keine grosse Chance...
siehe unten :-)

> >Schau mal mit 'tdbdump /var/lib/samba/secrets.tdb' nach, ob dort ein
> >Eintrag fuer 'cn=smbadmin, ...' ist, und ob da entweder Dein
> >root-paswort drinsteht, ob ein 8 Zeichen lange alphanumerische
> >Buchstabenkombination.

> Ah, das tdbdump war wohl das Programm was ich vergeblich gesucht hatte. 
> Ich hab nämlich schon versucht mit dem Konqueror und mit den diversen 
> ldap... Utilities der Sache auf den Grund zu gehen, aber die waren nicht 
> so richtig auskunftsfreudig. Ich weiß nicht mehr genau bei welchen 
> Installations-Versuchen der smbadmin da war und wann nicht. Jedenfalls 
> hatte der, wenn er da war, offensichtlich immer ein Passwort, das ich 
> nicht kannte.


> Ja, ich werd mal den Tipp vom Lars mit dem 'admin' statt 'smbadmin' 
> ausprobieren. Viele Grüße,

Das wird bei Dir vermutlich auch funktionieren :-)

Ich haben den Fehler mittlerweile gefunden:
 In der in pr46 (pr45 habe ich mir noch nicht angeschaut) installierten
 Version von der Benutzerverwaltung sind meine Aenderungen nicht mehr
 enthalten... ich werde das klaeren, damit der Fehler wieder behoben
 wird. :-/
 Dadurch wird durch die Skripte der Benutzerverwaltung der Passwort,
 mit dem Samba sich mit dem LDAP-Server unterhalten soll, auf der root-
 passwort der Systems gesetzt und somit klappt die Anmeldung mit smbadmin
 nicht mehr, da dieser Account ein zufaelliges Passwort hat, das
 normalerweise nicht mit der root/admin-Account uebereinstimmt... :-/


Eine Loesung ist, samba zu sagen, er solle sich als 'admin' verbinden,
was allerdings den Nachteil hat, dass Samba mehr Rechte im LDAP hat, als
noetig. Diese Loesung funktioniert, und sollte auch weiterhin schmerzfrei
funktionieren.


Die zweite und von mir praeferierte Loesung waere, die beiden
entsprechenden Skripte zu korrigieren und ein neues Passwort fuer den
smbadmin-account zu setzen.

Folgendes ist zu tun:
 * Die beiden .diff-Dateinen im Anhang nach /usr/share/webmin/ldap-users
   kopieren und dort jeweils 'patch -p0 < $datei' aufzurufen.
  -> Damit sind die unnoetigen Aufrufe aus der Userverwaltung entfernt.

 * Mit
   'ldappasswd -x -ZZ -D cn=admin,ou=people,dc=skole,dc=skolelinux,dc=no -W
    cn=smbadmin,ou=people,dc=skole,dc=skolelinux,dc=no'
   wird fuer den smbadmin-account ein neues zufaelliges Passwort
   generiert, gespeichert und ausgegeben.
   Das sieht etwa so aus:
   | tjener:~# ldappasswd -x -ZZ -D 
   | cn=admin,ou=people,dc=skole,dc=skolelinux,dc=no -W
   | cn=smbadmin,ou=people,dc=skole,dc=skolelinux,dc=no
   | Enter bind password:
   | New password: zAz9n8VS
   | Result: Success (0)

   Bei der Abfrage "Enter bind password:" muss das aktuelle
   root-passwort des Systems eingegeben werden, damit auf den LDAP-Baum
   geschrieben werden kann.
   
   Wichtig: Bevor samba das neue Passwort mitgeteilt werden kann, muss
   in der smb.conf die 'ldap admin dn' wieder auf smbadmin... gestetzt
   werden. Nachdem dies getan ist, kann man samba ueber das neue
   Passwort wie folgt erleuchten:
   'smbpasswd -w zAz9n8VS'


 Ich hoffe, dass ich nicht uebersehen oder vergessen habe :-)
 Falls jemand weiter Probleme mit dem Kram hat, einfach noch einmal
 melden :-)

HTH
Ciao
Max
-- 
	Follow the white penguin.
--- smb_create.pl	Sun Nov  9 01:45:08 2003
+++ smb_create.pl.new	Mon Feb 23 15:32:36 2004
@@ -15,7 +15,6 @@
 sub change_samba {
         $student_id = $_[0];
         $newpass = $_[1];
-	$rootpass = $_[2];
 	$tempfile = "/tmp/.smbhack.$$";
 	umask(0177);
         open TEMP, ">$tempfile";
@@ -25,19 +24,11 @@
 	# try to add the user to samba
         $ret = `/usr/bin/smbpasswd -a -s $student_id < $tempfile`;
 
-	# if it failed we change the rootpw samba uses, and try again
-	# we assume the ldap admin pw has changed (or it is the first time)
 	$retmsg = "";
+	$ret = `/usr/bin/smbpasswd -a -s $student_id < $tempfile`;
 	if($?) {
-        	$ret = `/usr/bin/smbpasswd -w $rootpass`;
-		if($?) {
-			$retmsg .= "Failed to update ldap admin passwd in samba!";
-		}        
-        	$ret = `/usr/bin/smbpasswd -a -s $student_id < $tempfile`;
-		if($?) {
-			$retmsg .= "Failed to add user $student_id to samba!\n";
-		}
-        }
+		$retmsg .= "Failed to add user $student_id to samba!\n";
+	}
 
         unlink "$tempfile";
 
@@ -49,9 +40,9 @@
 }
 
 if ($#ARGV < 1) { 
-	print "syntax: smb_create.pl <username> <password> <ldap-adminpw>\n";
+	print "syntax: smb_create.pl <username> <password>\n";
 	print "\ta user that already exist will only get the password changed\n";
 	exit(1);
 	}
 
-print change_samba($ARGV[0], $ARGV[1], $ARGV[2]);
+print change_samba($ARGV[0], $ARGV[1]);
--- index.cgi	Sun Nov  9 01:45:08 2003
+++ index.cgi.new	Mon Feb 23 15:32:31 2004
@@ -67,13 +67,12 @@
 					print "$text{'userpwchanged'}" 
 					    if ldap_mod_user ($in{'userUid'}, $rootpw,
 							      'userPassword', "{crypt}" . &gen_crypt($in{'editpw'})) ;
-            if ($config{'sambasync'}) {
-              # update samba password, too
-							my ($res, $out) = run_script("smb_create.pl",
-																						latin1($in{'userUid'})->utf8,
-																						$in{'editpw'}, $rootpw);
-							print $out;
-						}
+            if ($config{'sambasync'})
+	    {
+            	# update samba password, too
+		my ($res, $out) = run_script("smb_create.pl", latin1($in{'userUid'})->utf8, $in{'editpw'});
+		print $out;
+	    }
 				}
 				# Add a user to one or more groups.
 				my @memberGroups ;
@@ -336,17 +335,12 @@
 	  }
 	  else {
 	    # check if sambasync is set, add user if it is
-	    if ($config{'sambasync'}) {
-		    # hack to make sure root has a samba-accound (first time run)
-		    my $rootuser = ldap_get_user("root");
-		    if (not $rootuser) {
-		      my ($res, $out) = run_script("smb_create.pl", latin1("root")->utf8, $rootpw, $rootpw);
-		      print $out;
-		    }
+	    if ($config{'sambasync'})
+	    {
 		    # add the new user to samba
-        my ($res, $out) = run_script("smb_create.pl", latin1($uid)->utf8, $userpw, $rootpw);
+		    my ($res, $out) = run_script("smb_create.pl", latin1($uid)->utf8, $userpw);
 		    print $out;
-      }
+	    }
 	    
 	    print "<h1>". text("added",$uid) ."</h1>\n";
 	    

Reply to: