Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,244
» Latest member: dangyc
» Forum threads: 4,031
» Forum posts: 16,406

Full Statistics

Online Users
There are currently 265 online users.
» 0 Member(s) | 261 Guest(s)
Applebot, Baidu, Google, Yandex

Latest Threads
how to allow only steam t...
Forum: Xorg Problems
Last Post: moquber
2026-03-17, 09:40 PM
» Replies: 0
» Views: 301
Wi-Fi works for a few min...
Forum: Network Problems
Last Post: kabifff
2025-12-15, 12:57 AM
» Replies: 0
» Views: 677
How to install Archboot i...
Forum: Network Problems
Last Post: Meup
2025-05-13, 01:41 PM
» Replies: 0
» Views: 4,031
clear logs in smoothwall
Forum: Security and Firewalls
Last Post: amanda63
2024-03-10, 03:27 PM
» Replies: 8
» Views: 125,267
I cannot install RedHat 8...
Forum: Redhat
Last Post: hybrid
2023-11-11, 01:01 PM
» Replies: 1
» Views: 75,409
How things are done, usin...
Forum: Xorg Problems
Last Post: ross
2023-09-04, 09:03 AM
» Replies: 0
» Views: 5,408
Im back.....
Forum: Hello
Last Post: anyweb
2021-01-17, 11:36 AM
» Replies: 1
» Views: 9,230
add mp3 plugin to xmms in...
Forum: Fedora
Last Post: anyweb
2021-01-17, 11:30 AM
» Replies: 11
» Views: 47,575
Configuring VSFTPd Server
Forum: FTP Server
Last Post: Johnbaca
2020-10-14, 10:25 AM
» Replies: 32
» Views: 166,550
Wolf won't play sound!
Forum: Game Problems
Last Post: Guest
2020-10-03, 05:51 PM
» Replies: 1
» Views: 98,063

 
  How-to: password-protect a file/directory in Apache using htaccess
Posted by: anyweb - 2004-05-11, 12:49 PM - Forum: LAMP - Replies (7)


this is a quick howto for setting up protected directories on your newly installed apache webserver (thanks to michael on IRC for help with this).

 

first of all you'll need to decide what directory you want to protect, in the example below we are going to protect a directory called /usr/local/apache/htdocs/private

 

you can also assume in this example that we are serving webpages from /usr/local/apache/htdocs/

 

also to note:

 

http://httpd.apache.org/docs/mod/mod_access.html mod_acess is also required for using .htaccess

 

e.g.



Code:
LoadModule access_module /usr/lib/apache/1.3/mod_access.so




 

ok.. where do we start ?

 

 

STEP one: edit your httpd.conf file

 

first of all you need to edit your httpd.conf file and define a few things, notably you want to tell apache which directory to protect

 

if you compiled apache as in the example here then your httpd.conf file will be located in /usr/local/apache/conf/httpd.conf so using your favorite text editor lets start editing the file and add the following (which you should change for your path)

 

 

 



Code:
<Directory /usr/local/apache/htdocs/private/>
   AllowOverride All
   Order allow,deny
   Allow from all
</Directory>




 

 

also make sure your httpd.conf file has the following in it

 



Code:
AccessFileName .htaccess
<Files ~ "^\.ht">
  Order allow,deny
  Deny from all
  Satisfy All
</Files>




 

 

ok done, save your file.

 

 

STEP two: create .htaccess file and put it in the chosen directory

 

Now we need to create a new file and paste the following info into it

 

the file is going to be called .htaccess, please note the . infront of it, that is because it is a hidden file.

 

copy/paste the following text into this new file and Please note: AuthUserFile must include an absolute path so "AuthUserFile .htpasswd" doesnt work if you have .htpasswd in your current directory

 



Code:
AuthName "Authorization required"
AuthType Basic
AuthUserFile /var/www/.htpasswd
AuthGroupFile /dev/null
require valid-user




 

please note that the path /var/www/.htpasswd can change according to where you want it to be, and that at this point, the file .htpasswd does not yet exist.

 

ok, save the file and test to see that it exists by doing a ls with some switches to see hidden files.

 

 

 

 



Code:
[root@www private]# ls
index.html
[root@www private]# ls -alxhs
total 96K
4.0K .  4.0K ..  4.0K .htaccess   84K index.html
[root@www private]#




 

Now you can see the hidden .htaccess file and that it exists.

 

 

STEP three: create a 'apache' virtual user/password file called .htpasswd

 

Ok now we need to actually create a 'virtual' user with a password, this user/pass is not a system user it is only used by apache to give access to the specified directory.

 

 

To create the users lets change directory to where we want the .htpasswd file stored, in the example above its in /var/www/

 

 

 



Code:
cd /var/www




 

Now we are there, lets make the file, to do this we use a program called htpasswd.

 

 



Code:
htpasswd -c /var/www/.htpasswd anyweb




 

It will prompt you for a password, enter it and then confirm it.

 

Once done confirm the file is present (it is hidden remember)

 

 



Code:
[root@www www]# ls -alxhs
total 32K
4.0K .      4.0K ..    4.0K cgi-bin  4.0K error  4.0K html  4.0K .htpasswd
4.0K icons  4.0K mrtg




 

good its there, the file will now contain the username you specified (in this case anyweb) and an encrypted password that looks something like this

 

 

 



Code:
anyweb:ARmbxDd.dE




 

STEP four: edit httpd.conf, add the path to the dir to protect, save, restart apache and test

 

Edit your httpd.conf file (usually in /usr/local/apache/conf if you compiled it)

 

find a section that reads

Quote:## Controls who can get stuff from this server.

#

Order allow,deny

Allow from all

</Directory>
 

and change it so that it includes the path to the directories you want password protected (and which you also copied the .htacess file into the root of)

 



Code:
#
# Controls who can get stuff from this server.
#
  Order allow,deny
  Allow from all
</Directory>

<Directory /usr/local/apache/websites/homedns/cv/>
   AllowOverride All
   Order allow,deny
   Allow from all
</Directory>

<Directory /usr/local/apache/websites/kicks-ass/personal/family/>
   AllowOverride All
   Order allow,deny
   Allow from all
</Directory>




 

save httpd.conf.

 

 

Let's restart apache so that it can read the newly edited httpd.conf file to do so issue the following as root

 



Code:
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start




 

That's it you are done, now test it by browsing in Mozilla to the 'protected' directory, you should be prompted for a username/password to access it !

Print this item

  MySQL ./configure error
Posted by: halpern - 2004-05-11, 08:50 AM - Forum: Debian - Replies (2)


After extracting mysql, moving it into /usr/local/src, cding into it and then doing :

 

./configure --prefix=/usr/local/mysql \--localstatedir=/usr/local/mysql/data \--disable-maintainer-mode \--with-mysqld-user=mysql \--enable-large-files \--without-comment \--without-debug \--without-docs \--without-bench

 

 

i get the following error: (not allowing me to complete configure)

 

checking for termcap functions library... configure: error: No curses/termcap library found

 

i tried doing apt-get intsall termcap-compat but that didnt work. I still receieved the error. Any assistance is greatly appreciated. Thanks!

Print this item

  How do I get a compiler?
Posted by: justin1911 - 2004-05-10, 07:33 PM - Forum: Compiling - Replies (6)


So far everything I have installed on my new Fedora machine has been an RPM. I am now working on installing Apache/MySQL/PHP using the instructions in Anyweb's tutorial (btw its been great so far!) I'm getting up to the point of compiling, and I do not have a compiler, cc or gcc. I've read several things, tried installing GCC from an RPM I found on google, but it did not work. I'm not sure if it's installed or not.

 

Does anyone know of a working GCC RPM I can use? Is it possible to get a compiler on a machine that doesn't have one to begin with?

 

Thanks in advance.

 

Justin

Print this item

  Hi I'm Justin
Posted by: justin1911 - 2004-05-10, 07:20 PM - Forum: Hello - Replies (1)


I've been skulking around this site for a few weeks now, soaking up loads of good information. I came here on a Windows 2000 machine, and I am now making my first post here on a Fedora Core 1 machine. I am loving every minute of it so far. Getting this box up and going hasn't been anywhere close to smooth, but I enjoy a good challenge B) Anyway, I just thought I would finally post and introduce myself before I start making threads.

 

Thanks,

Justin

Print this item

  drivers
Posted by: Lem0 - 2004-05-09, 10:47 PM - Forum: Games in Linux - No Replies

ive heard a little about needing new nvidia drivers to run games in linux. could anyone tell me more about that?

Print this item

  quake 3 in longhorn 4074
Posted by: anyweb - 2004-05-09, 09:23 PM - Forum: Vista - No Replies


it works fine after i installed the nvidia drivers and audio drivers :)

 

see !

<a class="ipsAttachLink ipsAttachLink_image" href="<fileStore.core_Attachment>/post-12-1084137831.jpg" data-fileid="131">[img]<fileStore.core_Attachment>/post-12-1084137831.jpg[/img]</a>



Attached Files
.jpg   quake3.JPG (Size: 216.22 KB / Downloads: 0)
Print this item

  nvidia drivers installed in longhorn 4074
Posted by: anyweb - 2004-05-09, 08:21 PM - Forum: Windows - No Replies


i installed them by pointing to the actual driver and doing it manually

 

in device manager right click on the display adapter, choose properties, update driver, don't choose (manual) and then point it to the inf file - next next next and reboot :)

 

worked fine and now it ROX video wise

 

see screenshot :)

 

cheers

 

anyweb

<a class="ipsAttachLink ipsAttachLink_image" href="<fileStore.core_Attachment>/post-12-1084134062.jpg" data-fileid="130">[img]<fileStore.core_Attachment>/post-12-1084134062.jpg[/img]</a>



Attached Files
.jpg   nvidia.JPG (Size: 268.6 KB / Downloads: 0)
Print this item

  more 4074
Posted by: anyweb - 2004-05-09, 03:25 PM - Forum: Windows - No Replies


cool or what :)

<a class="ipsAttachLink ipsAttachLink_image" href="<fileStore.core_Attachment>/post-12-1084116346.jpg" data-fileid="129">[img]<fileStore.core_Attachment>/post-12-1084116346.jpg[/img]</a>



Attached Files
.jpg   nice.JPG (Size: 312.93 KB / Downloads: 0)
Print this item

  Photoshop on linux
Posted by: neurosis - 2004-05-09, 07:37 AM - Forum: General - No Replies

[img]<___base_url___>/uploads/emoticons/default_mad.gif[/img]

Print this item

  need to uninstall some tarballs and re-install rpm
Posted by: vandal - 2004-05-08, 09:05 PM - Forum: Redhat - No Replies


I need some help, i installed openssh via a tarball and would like to 'uninstall it' and reinstall the rpm from the distro.

 

can anyone walk me through the steps needed to do this?

 

thanks

 

van

Print this item