• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst] .htacces ohne Funktion

Hi,

ja ich weis Ihr könnt es bestimmt nicht mehr hören (ich habe aber schon min 10 Beträge bezüglich .htaccess durchgelesen aber es funktioniert immer noch nicht)

Ich habe Suse10.2 und einen Apache2 Webserver der Funktioniert.

Code:
DocumentRoot "/srv/www/htdocs"

Code:
<Directory "/srv/www/htdocs">
	# Possible values for the Options directive are "None", "All",
	# or any combination of:
	#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
	#
	# Note that "MultiViews" must be named *explicitly* --- "Options All"
	# doesn't give it to you.
	#
	# The Options directive is both complicated and important.  Please see
	# http://httpd.apache.org/docs-2.2/mod/core.html#options
	# for more information.
	Options +FollowSymLinks
	# AllowOverride controls what directives may be placed in .htaccess files.
	# It can be "All", "None", or any combination of the keywords:
	#   Options FileInfo AuthConfig Limit
	AllowOverride All
	# Controls who can get stuff from this server.
	Order allow,deny
	Allow from all
</Directory>

der zu verschlüsselnde Ordner liegt unter

/srv/www/htdocs/Downloads

darin befindet sich die .htaccess datei :

Code:
AuthName        "Zugriff nur mit Passwort!"
AuthType        Basic
AuthUserFile    /srv/www/.htpasswd
AuthGroupFile   /dev/null
Require         valid-user

in /srv/www liegt die .htpasswd welche über

Code:
heinrich@linux-server:/srv/www> htpasswd2 -cm .htpasswd pascal

erstellt wurde


ich weis nicht an was es hängt

es kommt immer die Fehlermeldung

Zugriff verweigert!

Der Zugriff auf das angeforderte Objekt ist nicht möglich. Entweder kann es vom Server nicht gelesen werden oder es ist zugriffsgeschützt.

Sofern Sie dies für eine Fehlfunktion des Servers halten, informieren Sie bitte den Webmaster hierüber.
Error 403
192.168.123.179
Tue Aug 7 11:20:04 2007
Apache/2.2.3 (Linux/SUSE)
 
In general, you should never use .htaccess files unless you don't have access to the main server configuration file. There is, for example, a prevailing misconception that user authentication should always be done in .htaccess files. This is simply not the case. You can put user authentication configurations in the main server configuration, and this is, in fact, the preferred way to do things.

Siehe auch hier: http://httpd.apache.org/docs/2.2/howto/htaccess.html
 
hmm

ich kann mit einer englischen Beschreibung nicht viel anfangen

kann man nichts aus meinen Informationen erkennen ?
 
hmm es funktioniert nicht und ich weis nicht was ich falsch gemacht habe

hab die ganze beschreibung durch aber es geht nicht.

ich hab im Verzeichnis

/srv/www/htdocs/Downloads eine .htaccess Datei in der steht:

Code:
AuthName        "Zugriff nur mit Passwort!"
AuthType        Basic
AuthUserFile    /srv/www/.htpasswd
Require         valid-user
AutoIndex ON

und die .htpasswd liegt unter /srv/www/.htpasswd

Code:
pascal:gEemA.sy/D1vU

und in meiner default-server.conf habe ich alle AllowOverride auf ALL gesetzt.

Code:
# Global configuration that will be applicable for all virtual hosts, unless
# deleted here, or overriden elswhere.
# 

DocumentRoot "/srv/www/htdocs"

#
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs">
	# Possible values for the Options directive are "None", "All",
	# or any combination of:
	#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
	#
	# Note that "MultiViews" must be named *explicitly* --- "Options All"
	# doesn't give it to you.
	#
	# The Options directive is both complicated and important.  Please see
	# http://httpd.apache.org/docs-2.2/mod/core.html#options
	# for more information.
	Options +FollowSymLinks
	# AllowOverride controls what directives may be placed in .htaccess files.
	# It can be "All", "None", or any combination of the keywords:
	#   Options FileInfo AuthConfig Limit
	AllowOverride All
	# Controls who can get stuff from this server.
	Order allow,deny
	Allow from all
</Directory>

# Aliases: aliases can be added as needed (with no limit). The format is 
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL.  So "/icons" isn't aliased in this
# example, only "/icons/".  If the fakename is slash-terminated, then the 
# realname must also be slash terminated, and if the fakename omits the 
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings.  If you
# do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/usr/share/apache2/icons/"

<Directory "/usr/share/apache2/icons">
	Options Indexes MultiViews
	AllowOverride ALL
	Order allow,deny
	Allow from all
</Directory>

# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"

# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/srv/www/cgi-bin">
	AllowOverride ALL
	Options +ExecCGI -Includes
	Order allow,deny
	Allow from all
</Directory>

# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# To disable it, simply remove userdir from the list of modules in APACHE_MODULES 
# in /etc/sysconfig/apache2.
#
<IfModule mod_userdir.c>
	# Note that the name of the user directory ("public_html") cannot simply be
	# changed here, since it is a compile time setting. The apache package
	# would have to be rebuilt. You could work around by deleting
	# /usr/sbin/suexec, but then all scripts from the directories would be
	# executed with the UID of the webserver.
	UserDir public_htm
	# The actual configuration of the directory is in
	# /etc/apache2/mod_userdir.conf.
	Include /etc/apache2/mod_userdir.conf
	# You can, however, change the ~ if you find it awkward, by mapping e.g.
	# http://www.example.com/users/karl-heinz/ --> /home/karl-heinz/public_html/ 
	#AliasMatch ^/users/([a-zA-Z0-9-_.]*)/?(.*) /home/$1/public_html/$2
</IfModule>


# Include all *.conf files from /etc/apache2/conf.d/.
#
# This is mostly meant as a place for other RPM packages to drop in their
# configuration snippet.
#
# You can comment this out here if you want those bits include only in a
# certain virtual host, but not here.
#
Include /etc/apache2/conf.d/*.conf

# The manual... if it is installed ('?' means it won't complain)
Include /etc/apache2/conf.d/apache2-manual?conf

was ist da falsch ich verstehs einfach net mehr hab alles nach Anleitung gemacht

wenn ich den Ordner Downloads aufrufe dann kommt keine Passwortabfrage.

es kommt:

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.
Error 403
192.168.123.179
Wed Aug 8 00:54:45 2007
Apache/2.2.3 (Linux/SUSE)
 
Zugriffsrechte der Datei /srv/www/.htpasswd?

Schmeiss die Datei mal in ein anderes Verzeichnis. (100% geraten)

Weiß jemand ob der Eintrag:

# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>

so einen Fehler verursachen kann?
 
Nein, der Eintrag verhindert das nicht!

Wenn du alles nach Regel gemacht hast, dann muss es funktionieren - außer dein Apache ist ohne die entsprechenden Module am laufen. Ich meine das heißt mod_auth oder etwas in der Art.

Code:
<Directory /var/www/localhost/htdocs>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/var/www/localhost/htdocs/sub/thoughts">
        AllowOverride All
        Options FollowSymLinks
        Order allow,deny
        Allow from all
        #Require valid-user
</Directory>

Code:
AuthName "secure area"
AuthType Basic
AuthUserFile /etc/web/.htpasswd
require valid-user
 
So erstmal danke für die Antworten...

das verschieben der .htpasswd in ein anderes Verzeichnis hat nichts gebracht(habe natürlich auch den Pfad in der .htaccess geändert)

das Modul "modul=auth" sollte bei Suse Apache2 standardmäßig installiert werden. (weis aber nicht wie man das überprüft)


hier meine log files:

http://www.pahe.cwsurf.de/Linux/
 
ich habe was entdeckt ...

die rechte der .htaccess haben nicht gestimmt

ich hab der .htaccess jetzt chmod 755 gegeben

jetzt kommt eine login abfrage


danach aber der Fehler dass kein Index dokument vorhanden ist

aber mal schauen hat bestimmt was mit "autoindex" zu tun

edit1:

wie muss das Passwort eigentlich generiert werden mit htpasswd oder htpasswd2 ? ist das egal ?
 
so jetzt hab ich's

wenn ich eine Index.htm im ordner habe funktionierts wenn nicht dann bekomme ich den fehler zugriff verweigert

was muss ich machen dass eine Dateiauflistung angezeigt wird ...
 
Danke,

ich habe irgendwo "AutoIndex On" aufgeschnappt aber das hat nicht funktioniert...

jetzt funktionierts aber :D
 
Oben