• No results found

Although Mac OS X is primarily known for its GUI, the under pinnings are all Unix. This

N/A
N/A
Protected

Academic year: 2021

Share "Although Mac OS X is primarily known for its GUI, the under pinnings are all Unix. This"

Copied!
10
0
0

Loading.... (view fulltext now)

Full text

(1)

BE Computing

Web Tutorials: Server Commands

Server Commands Indluded:

1. Basic Command Line Tutorial

Although Mac OS X is primarily known for its GUI, the underpinnings are all Unix. This tutorial will help you begin to function at the command line.

2. Changing Your Password

Need to change your password on the server. Here is a tutorial explaining how to do this.

3. Understanding Permissions

Are you having problems sharing or editing a file on the webserver? Better check your permissions...

4. Securing Web Content With .htaccess

Although Mac OS X is primarily known for its GUI, the under pinnings are all Unix. This tutorial will help you begin to function at the command line.

Command Line/Terminal

* At the command prompt type: yourusername@servername.caup.washington.edu * You will then be prompted to enter your password

1. Basic Unix Commands

Once you have logged in to the server using a command line application there are a few commands you will need to know in order to function.

Change Directories - cd

cd is the command to use when you want to change your current directory. List Directory Contents - ls

Typing ls at the command prompt will display a list of all the files and subfolders within your current directory. Typing ls -la will provide a more detailed listing showing hidden files, file permissions, differentiate files from folders, file ownership and more.

Create a Directory - mkdir

Typing mkdir folder-name will create a new folder in the current location. Delete a Directory - rmdir

(2)

To remove a directory type rmdir folder-name. Note, the folder must be empty for this command to work.

Delete a file - rm

To delete a specific file type rm file-name. Change your password - passwd

When logged in to the server that you wish to change your password on, type passwd youruserid. You will then be prompted to enter your old password. After you have done this you will be prompted twice to enter your new password.

2. Changing Your Password

When you get a new account on a BE server, you will be given a temporary password. To protect the security of your files, you should change this to a password known only to you as soon as you can.

To change your password you will need to log in to the server using a command line application. On the Mac, the application is Terminal, which is part of the operating system. On Windows, you can use SSH Tectia, which provides both a terminal window and an SFTP file transfer window. (SSH Tectia is provided by UW Technology as part of their UWICK package:

http://www.washington.edu/uware/uwick/contents.html)

Instructions for using these applications to change your password appear below for both Mac OS X and Windows. Should you lose or forget your password, please contact the BE

Webmaster to have it reset.

Mac OS X: Open Terminal.app (/applications/utilities/terminal.app). Terminal will open to a command prompt where you will type: ssh yourusername@server.address, for example 'ssh user@online.caup.washington.edu'. Then press enter.

(3)

Enter your current password at the prompt. Note that no characters will appear as you type.

You have now successfully logged into the server. To change your password type: passwd yourusername.

Type your old password to verify you have permission to change it.

Type in your new password, and re-enter it when prompted. Use at least 6 characters in your password. For passwords try using a combination of numbers, special characters (*&$%#), upper and lower case letters.

(4)

You have successfully changed your password. You can now exit the terminal application. Windows: Launch SSH Tectia. You'll get a screen that looks like this:

(5)

Click on the Quick Connect button, and enter the server name and your username (online.be.washington.edu and BELab09-A, in this case) in the dialog box:

Click "Connect", and enter your password in the Password blank (it will appear as asterisks)..

Assuming your password worked, you'll be connected. Back at the main screen, click the Terminal button (circled in red):

In the resulting terminal window, type passwd username

to change your password (the username in the example below is BELab09-A). You'll be asked to enter your current (old) password, then your desired new one (twice). Please use at least 6 characters in your password, ideally involving a combination of numbers, special characters (*&$%#), and upper and lower case letters. Here's how it will look:

(6)

Note that nothing will appear when you type in your old and new passwords.

3. Understanding Permissions

Mac OS X uses Unix style file permissions to control access to files. I you are having problems editing or viewing a file, it may be related to a file permission issue. You can also use

permissions to protect your files from being altered by other users. Who You Are

In the Unix world you are one on three people - owners, group members and everyone else. If you are the owner of a particular file/folder you have full control over that file/folder, but you can

(7)

limit what other members of your group can do with this file. All users are also members of at least one group.

Reading Permissions

The first thing to understand permissions is to understand how to read permissions. From a command line typing ls -la would display a list of all the files in the current folder, with their permissions. Here is an example

Permissions User Name User Group Date File/Dir Name drwxrwxr-x user course101 12 Oct

09:53 . drwxr-xr-x user course101 15 Sep

13:27 .. -rw-rw-r-- user course101 29 Aug

03:15 file1.txt drwxrwxr-x user course101 20 Sep

16:37 directory1 -rwx--- user course101 11 Feb

2003 file2.txt drwxrwxrwx user course101 17 Jun

12:05 directory2

There are 4 groupings of characters that tell you information in the permissions.

Type Owner Group Other

- r w x r w x r w x

The first character identifies the entry. It will be set to one of the following settings: d = Directory

l = Link - = File

The next 3 sets of 3 characters correspond to the three types of users on the system (Owner, Group, Other). In each set there is a read (r), write (w), and a execute (x) setting.

(8)

r = Read, allows users to open and view a file/directory w = Write, allows users to edit the file/directory

x = Execute, allows users to run an executable file

From the example above, you can see that file1.txt has its permissions set to: -rw-rw-r--

This means the the owner (user) and group (course101) members can read and write to this file, Other users may only read the file.

Changing Permissions

When changing permissions on a file from a command prompt you will need to use the command chmod. The syntax for writing this command is this:

chmod -R 777 documents

This command would set the permissions on all the files/folders contained within the folder "documents" to full permissions for everyone (rwxrwxrwx).

The -R flag makes the command recursive

The 777 tells the command what permissions to apply to each group (7 for Owner, 7 for Group and 7 for Others). Here is how we came up with these values

Permission Letter Representation Number Value Read r 4 Write w 2 Execute x 1 None - 0

These values can be combined to create any combination of permissions, as shown here. Permission Setting Calculated Letter Representation Translation 0 0 --- No Permissions 1 1 --x Execute Only

(9)

2 2 -w- Write Only 3 2+1 -wx Write/Execute Only 4 4 r-- Read Only 5 4+1 r-x Read/Execute Only 6 4+2 rw- Read/Write Only 7 4+2+1 rwx Read/Write/Execute Samples

Everyone can do anything - very insecure

Permissions Seen rwx rwx rwx Permission Value (4+2+1) (4+2+1) (4+2+1) Permission Setting 7 7 7

Read/Write for owner and group, everyone else can only read - moderately secure

rw- rw- r--

(4+2+0) (4+2+0) (4+0+0)

6 6 4

Full Control for owner and read only for group -very secure

rwx r-- ---

(10)

7 4 0

You can view a more detailed article regarding permissions at OSX faq.

4. Using .htaccess to protect web content

The apache webserver on the server has a built in function that allows users to protect folders with a id/password.

Create the htaccess file

In a simple text editor, create a file called .htaccess. In this file type: AuthName "Your Title"

AuthType Basic

AuthUserFile /server/documents/path/to/site/.htpasswd require valid-user

Place this file in the folder which you wish to protect content. Make sure you have the path to the .htpasswd file correct or your authentication attempts will fail. Example: if you web site address is:

http://online.caup.washington.edu/courses/Arch101 The path to your .htpasswd file will be:

/server/documents/courses/arch101/.htpasswd

Note this will also protect all files in subdirectories of this folder. Navigate to this folder using a web browser to verify the server prompts you to login.

Next you will need to create the htpasswd file. To do this log into the server from a command line application (tutorial). Navigate to the folder that you have placed the .htaccess file in and type the following:

htpasswd -c .htpasswd username New password: ********

Re-type new password: ******** Adding password for user username

You have now set up password protection on this folder and all its contents. Navigate to this folder using a web browser to verify the login/password are working correctly.

References

Related documents

equation · Wave equation · Frequency domain · Multigrid method · GPU acceleration · Matrix storage format · Frequency decimation.. Mathematics Subject Classifications (2010)

These events are distinct from authentication failures, blocked firewall connections and attempts to access web pages that do not exist that are respectively normalized to the

The WarpDrive card enables very high IOPS to accelerate high demand applications such as real time network analysis.. Where standard HDD technology might not be able to keep up,

More information on what mobile payment calculator to credit approval process easier for new home loan term of the calculation.. Responsible for rapidly appreciating values can

Police officers in Tarrant County and across the state of Texas can make temporary detentions of you and your vehicle for several reasons: (1) A Voluntary

- After 9 months: 9th Meeting with research advisor and submission of 5’000 word peer review journal paper at GSD. 6th Year: 1 Compulsory Visit

These stakeholders included DoD employees and their supervisors, federal government oversight agencies to include the Government Accountability Office (GAO) and the Office

from the Blues Brothers Movie Think Big Band Arranged by Philippe Marillia Vocal (Aretha) Aretha F ranklin Ted White Think f.. Think Think Think you think think