Changing htaccess Authname

I’d like to change the ‘Authname’ in my htaccess file so it displays something different than ‘Custom,’ and so my browsers will be able to remember the passwords for two different protected directories. But I can’t FTP an edited copy of the htaccess file (access denied), and my account doesn’t include telnet access. Are there other options?

All accounts come with shell access - just change your user to a shell user.

If you’re using the DreamHost .htaccess, the files will be owned by the Apache user and not your user, so you’ll need to remove the .htaccess stuff from the web panel, and then create the files from the command line.

Okay, feeling pretty dumb here: How do I create the .htaccess file from the command line?

[quote]Okay, feeling pretty dumb here: How do I create the .htaccess file from the command line?
You can do it using FTP - just create the file locally then upload it. Make sure its done using ASCII transfer mode.

If you’re using a Windows machine locally, you may need to name the file “htaccess.txt” - rename it to “.htaccess” using your FTP client.

You’re probably right–I could have removed the password-protection and then uploaded the file. But I managed to sort out the command line process, and here’s what I did:

  1. Remove the password protection through the Web Panel.
  2. Telnet to my domain.
  3. Change to the directory I wanted to password-protect by typing ‘cd path/to/directory’. You can type ‘ls’ to list the files and directories in the current directory–that’s like ‘dir’ to DOS users. Modify it like this: ‘ls -a’ to show hidden files, like .htaccess.
  4. Start a text editor. Forget vi or emacs, pico was more my speed. Type ‘pico’.
  5. Enter the text for the htaccess file. All I wanted to do was have something besides ‘Custom’ show up when the password prompt popped up, so all I had to do was copy the old .htaccess file contents and modify the relelvant info (after ‘AuthName’):

AuthType Basic
AuthUserFile /path/to/protected/directory/.htpasswd
AuthName "My Password-Protected Area"
require valid-user

  1. Type ‘Ctrl-X’ to finish editing. Pico will ask you if you want to save the file. Type ‘Y’, and type the name of the file to be saved (’.htaccess’). You’ll return to the command line.
  2. Create the .htpasswd file: type ‘htpasswd -c .htpasswd username’ where ‘username’ is the username you want to use. It will prompt you to enter the password twice. Then you’ll be all set.

This process is simple enough with instructions, but the disadvantage is that you can no longer modify access to that directory via the Web Panel.