Content | Navigation |

How To Set a Password into a Web Folder (using TELNET)

SUMMARY

The following document explains how to assign a password and login to access a web directory.

IMPORTANT: Since you will be working at the root level of your directories make sure to follow the instructions correctly. If you fail to follow the instructions you may loose files, information or lock yourself out of a directory.

The 1-2-3 summary steps to set a password and login to a directory are:

  1. Generate two files with a simple text writer (jove, vi, etc). Name the files as follows: ".htaccess" and ".htgroup"
  2. The .htaccess and .htgroup files should be created at the directory level which you want to be password protected.
  3. To create passwords you will need to type the following instruction for each login: /web/bin/htpasswd.pl -u login. As result a ".htpasswd" file will be generated by the system.

STEP 1

Find the Telnet SSH software on your computer. When you start it up, you'll see the following login screen. Change the Host to webdev.ndsu.nodak.edu as shown and choose OK.

login screen to Telnet SSH

Then you will be asked to login. Use your shortened UNIX ID to login. (Example: Instead of nancy.lilleberg, I would use nlillebe) The passphrase will be your usual NDSU Email password. --Click here to find out what your UNIX ID is --

supply login name and password on second screen

STEP 2

Go to your WEB directory by typing: cd ndsu_web

Go to the directory you would like to have password protected: cd directory

(You may need to do this a few times if your directory resides multiple levels deep.
In the example below, the cd pswd_protect command switched to the folder called pswd_protect)

List all your files in that directory: ls -la

changing directories to the one you want to protect

STEP 3

Let's create a .htaccess file through vi (unix text editor): vi .htaccess

start v i unix text editor

STEP 4

Type the following information in the .htaccess file:

AuthUserFile /web/ndsu/login_name/folder/.htpasswd
AuthGroupFile /web/ndsu/login_name/folder/.htgroup
AuthName ByPassword
AuthType Basic

<Limit GET>
require group MyGroup
</Limit>

where:
/login_name/ = is your login name. (In the following example, "nlillebe")

/folder/ = is the folder or directory where you are and you want to have password protection. (In the following example, "pswd_protect")

code for htaccess file

NOTE:
** If you have one of the very old web server logins, you might need to type /web/instruct/login_name/folder/ in the above coding if your login is in the e "instruct" area of the web server. f
** If nothing shows up on the screen as you type the .htaccess coding, you may have to type esc i to switch to insert mode.
** If you need to bail out, type esc :q!

STEP 5

To save this .htaccess file you will type esc :wq and hit the return key.

after saving the h t access file

STEP 6

Now, let's create a .htgroup file through vi (unix text editor): vi .htgroup

Type the following information in the .htgroup file:
(If nothing appears as you type, type esc i to switch back to insert mode)

MyGroup: username

where:
username = the user name that you want to create and/or have access to this directory.

NOTE: This example uses just one login, comm261, to be possibly shared by a group such as students enrolled in that course. You can specify multiple username if desired and create a different password for each username. (MyGroup: username1 username2 )

start creating the h t group file in the vi editor

STEP 7

To save this .htgroup file you will type esc wq and ihit the return key. 

STEP 8

To make sure that we have two files (.htaccess and .htgroup) in our protected directory let's type: ls -la

You should see the two file names listed.

listing of files in the password protected directory

STEP 9

To create a password for each user name you will need to type the following:

/web/bin/htpasswd.pl -u username

where
username is the user name you specified in .htgroup file (Step 6).
(In our example, user name = "comm261", so the command typed was /web/bin/htpasswd.pl -u comm261 )

You will be prompted for the password. Type the desired password and hit the return key.
(In our example, the password is webdev)

generate the password for the directory

The password will be encrypted and as result a ".htpasswd" file will be generated by the system.

NOTE: If you specified multiple usernames in step 6, you can define specific passwords for each username by repeating the /web/bin/htpasswd.pl -u username command for each username.

STEP 10

To ensure that we have all three required documents with the names:

.htaccess
.htgroup
.htpasswd

request another directory listing by typing: ls -la

 

STEP 11

When finished, type logout and hit the return key to leave the TELNET session, and then check your work by visiting your directory once there is a home page created in it.

 


Student Focused. Land Grant. Research University.

Follow NDSU
  • Facebook
  • Twitter
  • RSS
  • Google Maps

North Dakota State University
IT Help Desk Phone: +1 (701) 231-8685
Administrative Calls Only: +1 (701) 231-7961 / Fax: (701) 231-8541
Campus address: IACC 206
Physical/delivery address: 1320 Albrecht Blvd, Fargo, ND 58102
Mailing address: NDSU Dept. 4510 / PO Box 6050 / Fargo, ND 58108-6050
Page manager: Information Technology Services

Last Updated: Friday, August 12, 2011 12:29:36 PM