creating an .htaccess file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers creating an .htaccess file
# 1  
Question

I don't know anything about Unix but I have to create a htaccess file and a htpasswd file. I have instructions that tell me to "create an htaccess file using the vi editor" How do I get into the directory that should be password protected and how do I start creating the htaccess file? If I can get these two things answered, I think I will be okay, but if there is anyone who wants to offer more info, that would be great too!

Sorry, I'm such a dummy - but I hope someone can help me.

Thanks so much!
Whitney
# 2  
The "pico" editor would be easier to use if it is available on your system.
Try:

cd <directory_name>
pico .htaccess


If you do not have pico, then:
vi .htaccess


Once in vi, hit "i" to enter insert mode. type your text.
Hit the escape key to leave insert mode, then ":wq!" to write to disk and exit. If you prefer to quit without saving, it would just be ":q!"

Create the .htpasswd file with something like:
htpasswd -c /your/home/directory/.htpasswd username

[Edited by PxT on 02-06-2001 at 05:29 PM]
# 3  
Another good option to set for the vi newbie is showmode. This will show you whether you are in insetr mode etc. To do this, type
:set showmode
once you open vi.
# 4  
Thanks to both of you for your help. I was able to create the .htaccess file just fine. Now, when I'm trying to create the htpasswd file, I type this:

/usr/sbin/htpasswd -c .htpasswd whitney

and I get this message:
usr/sbin/htpasswd: cannot open file .htpasswd for write access
fopen: Permission denied

What the heck? Any suggestions?

Thanks again!
Whitney
# 5  
Sounds like your user does not have write permissions to the directory (or to the .htpasswd file if it exists). From the directory where the .htaccess file exists, type;
ls -ld .

You are looking for either group or user write permissions;
drwxrw-r--

If there is no w in the third or sixth position, type;
chmod ug+w .

If that checks out type this from within the directory that the .htaccess exists;
ls -la .htpasswd

If it exists, examine the permission and correct as above.
# 6  
Well, the w's were there and it looked good so I logged out and logged back in and it let me do it!

Go figure!

Anyway, thank you so much for your help - you're a life saver.

Whitney
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #983
Difficulty: Medium
The first official NetBSD release, NetBSD 0.1, was made on 9 April 1991.
True or False?

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Creating a captcha with amazon node .htaccess"

hello i have a project that i have to create a captcha can someone please help me do this in my mac terminal im a beginner tell me the steps to do this? in public_html, create a file named ".htaccess" with the following content: AuthType Basic AuthName "CIS440" AuthBasicProvider... (3 Replies)
Discussion started by: jr44
3 Replies

2. Web Development

.htaccess redirect with #

I have the following directive in my .htaccess: #RewriteRule ^mozrank/?$ "http://www.seobook.com/#a_aid=dh" The problem is that the redirect is going to http://www.seobook.com/%23a_aid=dh How to preserve the # when redirecting? (2 Replies)
Discussion started by: rlopes
2 Replies

3. UNIX for Advanced & Expert Users

Redirect with htaccess

Hi, I would like to use htaccess 301 redirect with URL hiding. Ex: when browse the website 'abc.com' it should show the contents of the page 'xyz.com/start/index.html' but in addressbar should show the domain 'abc.com'. I know it works with html URL frame rewrite. But my question is it... (0 Replies)
Discussion started by: chandranjoy
0 Replies

4. Cybersecurity

Logging htaccess

hi i am trying to make a log of all users who access my website, i am using htaccess to administrate logins, how does htaccess store a session i.e where is the valid user login temporarily stored while a user is using the site or is there already some sort of logging being done by htaccess. ... (2 Replies)
Discussion started by: omnibarb
2 Replies

5. Cybersecurity

htaccess

Something is wrong. I do everything right make the .htaccess file and stuff, but when I try the htpasswd command it says command not found. I use Putty SSH client and I think server is running RedHat 7.1 with Apache some version. HELP!!! (1 Reply)
Discussion started by: _hp_
1 Replies

6. UNIX for Dummies Questions & Answers

.htaccess

i want to protect a folder on my HP.... does the folder need more than ".htaccess" and ".htpasswd" to be protected , and ask for login and password??? Please help ...... i use HTAdmin 1.2.1 to manage my access files.. The systemadmin cant or wount answer.....:confused: Avenger (3 Replies)
Discussion started by: Avenger
3 Replies

7. UNIX for Dummies Questions & Answers

.htaccess?

For a schoolproject, I have to set up an intranet at a company headquarters in the Netherlands. But they want to give the division in the United States access to that intranet. I have to find out how to do that. I've heard that you can do that by giving certain people access to the intranet with... (1 Reply)
Discussion started by: Puc conDoin
1 Replies

Featured Tech Videos