datagram's
        [Halcyon Paradox]

                    [Understanding UNIX]
 

Identifying
Basic Commands
Permisions
Understanding and identifying permisions
Understand chmod
Accounts
Password files
Shells
-Compiling
Online with UNIX
-E-Mail
-World Wide Web
-FTP
-Newsgroups
-IRC
-Telnet Rlogin etc
Conclusion
Dedication
 
 
 
 

But first we have an intro.
 

Well here I am again writing another text for upzine. Again I am aiming my
text towards newer users, as judging from the mail replys we get (with a few
possible exceptions) our readers a fairly new. It is infinitely important for
new users to understand (the importance of) UNIX, which is why I am writing
this text. Its going to be quite long, so make sure have quite a bit of time
to digest it.

Indentifying

It is important to identify the flavour of UNIX you are dealing with, whether
you are on a shell or using your own computer running UNIX. If you have setup
UNIX yourself the chances are you already know what UNIX derivative you are
using so this part is of no relevance, so please move on. For the rest of you
listen up! When you boot up/log on to the computer you are using you should
see something like this.

SuSe Linux Version 5.2

User: (input here)
Pass: (blanked input here)

well thats easy enough to see, your flavour of UNIX is infact Linux, SuSe's
version of Linux.

However due to circumstances you may not have direct access, but no matter
how you use UNIX you should always (at one point at least) see a shell. Now
a common shell is the bourne style shell, it always starts with a $ and
after that, you put your input in. There is also a C shell, which starts with
a % and then you input.

Hopefully now you know which UNIX variant you run, now lets move on.
 

Some Basic Commands

ls

This command lists the files and subdirectories in a directory. If you
simply type "ls", it will display the files in your current directory.

Variable:
 
-a

This option will display all files, including hidden files.

Usage:-
$ ls -a
 .       ..      junk    upzine
$

cd

This is the command used to move from one directory to another. To go
to a directory directly below your current directory, type "cd
<dirname>".  You can at any time type 'cd' to return to your original dir.

Usage:-
$cd /home/upzine
$

or

$cd
$

You can use the next command to verify where you end up.

pwd

This states the pathname of the directory you are currently in.
You should use this command if you forget where you are. But people might
look at you in a weird way if you do it in the middle of a city, stick
to using it on computers, you get better results that way (he said from
experience:)

Usage:-
$pwd
/home/upzine

cat

This command allows you to view the contents of a text file.
The correct syntax used is  "cat <filename>".

Usage:-
$cat upzine8
The Legalisation Of Cannabis Discusion By darkflame
<snip rest of file>
$

rm

This deletes a file. Syntax: "rm <filename>".

Usage:-
$rm junk
$

cp

This commands copies a file. Usage: "cp file1 file2", where file1 is the
file you wish to copy, and file2 is the name of the copy you wish to create. If
 

Usage:
$cp /usr/junk /usr/junk.backup
 

Use these commands to manouvre around your UNIX box.

File Permisions

An important part of UNIX is its file permision system.

There are three permision types:

Read Permision:

Allows the user to look at the file, using the above command cat, and if
pico is installed you can use the command pico -w filename. You are allowed
to copy these files, and then you can set your own permisions, but you have
to rename it.

Write Permison:

Allows the user to make changes to a file, but not necesserally rename or
delete it, to do that you must be allowed to have write permision in the
whole directory. If you do have that, you can create files etc.

Execute Permision

No, you dont get to kill the file :-), it allows the user to run the file as
a program, whether it be a *real* program or a shell script. Dont try to run
a file that isnt made for running though.

Use the ls -a command to see what permisions the file has.

Understanding and Identifying Permisions

When you ls -a you will see something like:

-rwx-rw-r 1 group  users  10 Jul 4 20:36 Blah

Let's group these.

The first set is for the owner: we can see owner has:

rwx

This means the owner can read write and excecute the file.

The second set is:

rw

That means the group user can read or write to the file.

The last is:

r

It means anyone can read the file, even on a guest account.
 
REMEMBER:

r - read
w - write
x - executable

This naturally leads us onto chmod.

Understanding chmod.

chmod in UNIX is the change mode command. It lets you (if you have permision)
to change the permisions on a file. An example of chmod would be:

$chmod 777

But you may think 'why 777' ? What would that do ?

That would give the owner, group, and guest rwx access to the file.

Why ?

Well read write and excecute have values. They are:
 

     -  =  0
     r  =  4
     w =   2
     x  =  1

So to get 7 you do 4 +2 +1 = 7 So this means you have rwx permision on the file.
And since there are three possible users (owner group guest) you need to chmod
with three numbers following.
 

So say you just want to give rw permision you do (in your head) 4 + 2 = 6
And that will give you rw-

an example would be:

$chmod 764 misc

This would mean owner (who is always first) would have rwx because

read + write + excecutable= 7
= 4  +   2   +  1         = 7

The group (who is always seven would have read and write because:

read+write= 6
=4  + 2   =6

and guest would have read only access because:

read=4
4   =4

Get it ? Good.

Work out for yourself who would have what if I did:

$chmod 664 misc
 

Remember guest can also be called world depending on who you are talking to,
thats probably more accurate.

Accounts

There are two types of UNIX accounts, user-accounts, and Super-user accounts
(eg: root). There are plenty of users who would like to become super-users,
but that is illegal, so I wouldnt even try to tell you how to do it (even if
I could). Its not only 'root' that has super user privalages, umountfsys &
checkfsys usually have super user privilages too.

There are plenty of normal user accounts, some more interesting than others.
The most interesting user account to most hackers is the bin account. It
contains some interesting programs etc, have a look around.

Password Files

Well all UNIX systems have password files, you can find the main one by doing
this:

$cd /etc/passwd
$

This contains the super users password file, if you crack this, you have
remote admin access to a UNIX box, as well as other accounts,
but dont because it is illegal.

Most password files like that are shadowed now-a-days, here is the difference:

A part of a un-shadowed password file: (taken from hackersclub)

root:RqX6dqOZsf4BI:0:1:System PRIVILEGED Account,,,:/:/bin/csh

To break it down this is:

Username: root
Encrypted password: RqX6dqOZsf4BI
User number: 0
Group Number: 1
GECOS Information:  System PRIVILEGED Account
Home directory: /
Shell: /bin/csh

However a shadowed password file looks like this:

will:5fg63fhD3d:8960:1:60:10:90:10000

To break this down it shows:

Username: will
Encrypted password: 5fg63fhD3d
Last change: 8960  (Password was last changed on
Minimum days: 1     (Password must be kept for 1 day without changing)
Maximum days: 60    (Password must be changed every 60 days)
Warning days: 10    (User receives 10 days warning of required
                     password change)
Inactivity days: 90    (Account disabled if not used for 90 days)
Expiration date: 10000 (Account expires on
 

Note the difference, a shadowed password file is much harder to hack, if that
is what you were considering doing.
 

Shells

Well shells are UNIX boxes you connect to with a user-account set up for you.
There are a multitude of free shells which disable all the good features and
allow you to do, well, not much. They usually have disabled telnet, irc, and
background processes (bounce progs & eggdrop bots etc). You can still run
them but when they catch you, the disable them, and close your account, and
also possibly notify your ISP.
An interesting point to note though is the fact that these accounts usually
let you telnet to localhost.

Usage:

$telnet localhost
SuSe Linux v5.2

user:
pass:

Now as you know, the system moniters your host when you connect, and if they
have any trouble from you they notify your ISP. But if you telnet to localhost
then set up an account the only host the see is their own, because you
have connected to them from their own machine. So the worst the can do with
ease is close your account.

Compiling on shells.
 

Compiling a program on a shell or at all is simple you use the gcc command:

Usage:

gcc -o filename.c filename

then to run the program you..

./filename

Online with UNIX.

Electronic Mail (E-Mail)

E-Mail is the most common way of communicating with others on your network,
or with others in the outside world. E-Mail can be used to quickly pass
information. You can send an receive mail, whether it be informing you of
important information from your employers or simply fun corespondance with a
mate. When you login to a UNIX box, and you have mail,
it displays the message:

You have mail.

A fun thing to do if you have access to your friends computer is edit his
.profile file and adding the line:

echo You have no mail.

The .profile file is the file that is ran on most UNIX systems when you login,
on other UNIX systems it is .login . In the above example when a person logs
in they will see the message:

You have no mail.

displayed at the bottom. Anyway, enough of my meaningless dribble, on with
the explanation of e-mail.

In order to use e-mail you must be connected to a network, or the ultimate
network, the Internet. There are various E-Mail programs, and they have
different features, but, basically, they all do the same thing..
 

Here are various E-Mail programs, and they have different features, the three
most commonly used ones are: Mail Elm and my favourite PINE.

The aptly named 'mail' program is the easiest to find. To send mail to
someone on your network type:

$mail username@isp.com

In the user friendly tradition of UNIX you will be presented with nothing,
not even a prompt. You type the body of your text here. To finish and send
type control+d. Thats you done.

Note: Some versions of 'Mail' ask for a subject line, simply enter your topic
subject here.

To read mail with the mail program type:

$mail

It shows you un-read mail. Then you are displayed with a ? prompt.

Type h to see a list of mail
Type d to delete the current message
Type m and then email address to send a new message.
Type p to print.
Type ? for help
And if you have any sense you'll
Type q for QUIT!

The 'Elm' E-Mail program.

The E-Mail program 'elm' is a commonly used e-mail program amongst UNIX users.
The Elm program is easier to use than the forementioned 'mail' program. To
open the Elm program type:

$elm

Then the program should display a list of messages. The following list of
commands should help you navigate the elm program.
 

1. Use the j & k keys to highlight the message you want to read, reply to etc
2. Press the enter or return key to read the message highlighted.
3. Press d to deleted the message highlighted.
4. Press m to send a new mail message.
5. Press r to reply to the message highlighted.
6. Press s to save the highlighted message.
7. Press p to print the highlighted message.
 

To exit the program press q.

When sending a new message you are asked for an e-mail adress, subject etc.
When this is completed it runs a text editor, the default is vi. Then use vi
to edit the body of your mail. To exit and save changes after finishing hit
escape and type ZZ .

This done you a prompted with a display like this:

Choose e)dit message !)shell h)eaders c)opy file s)end or f)orget

or something similar.. (its been ages since i have used elm)

All the options are self explanitory.
 

The PINE E-Mail program.

Well, the old saying 'saving the best 'till last' applies here. The best
electronic mail program in my opinion is PINE. Its easy to use as well as
featureful. (Pardon my making up of words)

PINE in the beginning was a easy to use version of elm, but it has overtook
its creator, and now roams more powerfull than elm ever was. To run PINE type:

$pine

You are presented with a fairly user friendly option screen (AKA Main Menu)
which looks something like this:

[PINE 3.89] MAIN MENU

            ?  HELP                                     -Explanation
 
            C COMPOSE EMAIL             -Explanation

            I FOLDER INDEX                    -Explanation

            L FOLDER LIST                       -Explanation

            A ADDRESS BOOK              -Explanation

            S SETUP                                 -Explanation

            Q QUIT                                  -Explanation

   Copyright someyear-someyear, PINE is a trademark of a University
 
                 [Folder 'INBOX' opened with a message]

? HELP           P Prevcmd          R RelNotes
O OTHER CMDS     N Next Cmd         K KBlock

Where 'explanation' is, there is a short description of the option (i cant
remember what it is :-)) and I dont know what year the copyright is or what
Uni developed PINE, but full credit etc goes to them. One of the options is
highlighted, and to navigate you can toggle with the cursor keys and press
return or enter on the option selected, or you can hit the letter or character
to the left of the options.

To compose an E-Mail hit C . PINE then runs the editer pico with a form
ready for you to fill in with To CC Attchment & Subject feilds. Type in the
headers and then the body of the text. Use ctrl + x to exit. PINE sends the
message an returns you to the option screen. Hit Ctrl + C to cancel the mail
, Ctrl + t for a spell check and Ctrl + g for a complete online help referance.
 
 

To read mail type i at the options screen, or toggle to it and hit return.

You should see a list of messages (numbered). Those that are new have a +
beside them. You should see the date for each message, and the person who
sent you it's name or handle, you should also see the subject. To read a
specific message toggle to it and hit v to view the mail. To forward the
message type m and to reply type r. Delete is d etc
 

There are other options which you can learn yourself, I am showing you howto
send a read e-mail, of you ahve any queries about the other options of pine
dont hesitate to mail me.
 

World Wide Web

As you all should know if you are seeing this text, the web is the most popular
internet facility next to electronic mail. In this chapter I am going to stick
to traditional UNIX web browsing, although web browsers like Netscape etc are
available for Xwindows on UNIX.

The program us UNIX users like to use is a program called lynx (also available
for DOS etc) because it doesnt load any nasty time wasting images, simply
text.

To run lynx you simply type:

$lynx

On opening lynx, a page should load for you, and you can navigate from there
if you so wish, but if you want to do things your own way, you can enter the
URL you wish to view..

http://infoseek.go.com

is a good place to start, a man that goes by the name of Curiosity once typed:

'Seek and ye shall find, ask and ye shall be flamed'

Which is very relevant in today's usenet. (See newsgroup section)

You can go straight to a page by typing g and then typing the URL.

Please note: If you don't have lynx (for some reason) get it from:

ftp2.cc.ukans.edu in the /pud/lynx dir

(Hyper)Links are higlighted, and they represent the link to another page
or simply another part of the same page, the may also be a link to a file
which on selecting you will download. To move between links use the up
and down keys and press return on selecting the link you want. Hit the left
key to return to the page you were just browsing. Also links maybe numbered
so you can press the number of the link you want to move to and it goes auto
matically. Also you can return to the page you started with by typing m .
Use the page up and page down keys to navigate especially long pages.

Its not only web pages lynx handles its gopher, ftp, telnet & news also.

FTP

FTP is used for transfering files to and from computers, they work on the
(f)ile (t)ransfer (p)rotocal system thus giving it the tla (three lettered
acronym) FTP. You can download and upload to the public ftp servers, you can
download programs texts pictures, web pages, anything!

To ftp to a computer you use this command:

$ftp targetcomputer.com

targetcomputer.com is obviously replaced with the computer you are connected to.

If the computer allows you to connect you will get a message, saying the
machine is ready. If you are not a authorized user you will only be able
to logon to the remote computer via anonymous login. This is where when you
are prompted for a login you type anonymous and for the password you type
your e-mail address, but you dont have to you can type anything which includes
the @ character, although it is good netiquette to type a genuine one.

Before you start downloading, know what you want, if you want text files type

ftp>ascii
200 mode set to A

or if you want anything else type

ftp>bin
200 mode set to I

Bin being short for binary, and I being short for imagery (the alternitave name
for binary.)

To see what is out there for you you use the DOS version of ls dir.

ftp> dir
200 Port Command Succesfull.
150 Opening ASCII mode data connection for /bin/ls
total 10

It then goes onto list the files/sub directories.

To move between directories you do it in the same was as you would for UNIX
or DOS.

ftp>cd upzine
250 CWD command succesful.

This command would to you to the upzine directory.

Then you will want to get a file, make sure you know what the file type
is and what mode you should be in to get it. The command usage is.

ftp>get upzine5 (upzinefive.zip)

Replace upzine5 with the file you want to download, and remove the brackets
and change upzinefive.zip with the name you want to rename it to (should you
choose to do that)

You can also get loads of files at a time, with the mget command (stands
for massget or multiple get)

You have to use whats known as wildcards. The * character is used instead of
any character, and any amount of characters. Say you wanted to download all
the editions of upzine in a dir holding them you would use the command:

ftp> mget up*

However, if there was a file called up.and.away you would get that also.
BUT, it asks you before you start d/l every file. To stop it asking you
before every file, type prompt at the prompt :-)

In ftp you can also upload files, to do this you use the put command.
To place a zip of all the upzines in an ftp that for some reason doesnt have
them, you would use this command..

ftp>put upzine.zip upzine
 

There are other commands, so here is a quick summary of the most usefull ones.

del someting = deletes the file named something.
quit         = leaves the ftp.
cdup         = moves you to the higher dir next
lcd          = changes to a dir on teh local machine
dir up       = would list all the files on the current dir with the characters
               u & p .
 

Newsgroups

There are loads of possible usenet readers, but I'm only going to describe
one, because I only use one, and its the only one I really know about, and
if you dont like that..tough! Throughout my life I've used deja & Zimacs.
This is the only UNIX news reading prog I have used.

The one I am going to describle is trn . To run it type:

$trn

or

$trn -x -X

if you want to use all its features.

When you fist run trn it makes a hidden file called .newsrc and it gives
some messages, but you wont need them as you have this section of this text
to help you, the space bar removes them.

trn automatically has some newsgroups installed for you, you amy not want them
so you will have to spend some time removing them, but its worth it as you
dont want them cluttering up your space. It will go through an emmense amount
of news groups asking if you want to suscribe to them, suscribe to the ones
you want and when you have enough type ctrl + n, which selects no for the
rest of them.

After the saga ends you dont need to go thorugh this every time, trn does
you the justice of remembering the newsgroups you want to read. All the news
groups are contained in the file that is created and when more are created
you have the option of adding them to that file, when is asks you if you want
to add it you have 4 options.

Y (Capitalised) = Adds it your list of newsgroups.
y               = Adds and to your list of newsgroups, and starts you reading
                  it.
N (Capitalised) = Tells the program not to tell you about any new NGs.
n               = Skips that particular newsgroup.
 

trn also asks you if you want to read the messages you havent read in a
newsgroup you have suscribed to. Again, you have 4 standard options.

+ = this command shows you list of threads.
y = this command tells trn to go ahead and show you all the articles one
    at a time.
n = this command tells trn to not read the articles for now.
q = quit trn alltogether. (May seem tempting at early stage:)
 

You can also press u to unsuscribe from the group.

When trn gives you these options make sure you press a command.
The most popular command for new users of this quite complicated program
is the h command, which gives you online help.

When trn gives you the [+ynq] option you should know its about time to
start reading some news.

I usually use the + option, because when viewing big newsgroups (alt.ph.uk)
for instance there are lots of topics, hardly any of which are relevant
or interesting (Thank David Habanec, you spamming peice of ...)

You will see a list of articles, if you want to start reading the thread
press the letter assigned to it and read away. To see the rest of the
atricles in a thread press > and there are no more when you see bots.

One selecting the thread you want press Shift - X to mark all the other
postings as read to stop trn harassing you about reading them or Shift
N to forget about this newsgroup and move onto your next one.

After selecting the thread you are interested in  you start to see the
postings one at a time, to see the next screenfull of the article press
the space bar. If you can't be bothered with the post or someone has spolit
it by including their crap (Thanks again Habanec) then press j to mark
it as read.

If you feel that this or something else has spoilt the entire thread, or you
have got bored with it simply press k to kill the topic. If the newsgroup
has got into such a state you dont feel like reading it anymore (Habanec)
then press q and check later when hopefully more meaningful postings have
been made.

After you have finished and article, guess what.. you have more commands to
select from, (I didnt know all of these so thanks to all who helped me round
up most of them)

spacebar = see the next unread article
p        = to see the preceeding unread article (thanks J)
Ctrl R   = Read it again.
k        = marks all the articles for a specific thread as read.
c        = marks every posting in the NG as read.
u        = unsuscribes from the news group.
s        = saves the article just read as a file
Usage:
s filename

You may also want to respond to an article, you can respond in two ways:

1. You can follow up with your own posting to the newsgroup.
2. Respong to an articles author via private e-mail.

PLEASE READ THE FOLLOWING SUB-NOTE, ITS IMPORTANT!
<subnote>
This is just my advice, but i think you may find it invaluable.

If you have a problem with the person, or find what he has said to be out of
order etc reply via e-mail.

If you have something relating to the article that the whole group would
take interest in, or you have an opinion which doesnt match that of the
poster but can be put in a polite manner which will provoke discusion etc
post it. Or if the person has made an accusation against you which isnt
true etc, and you have proof to prove it isnt true, by all means let them
know. Don't post unconstructive critism, it will result in you being
flamed.

Its better to take a personal thing up via email, so this is how you do it.
<\subnote>

If you want to quote their original message, in the email hold down
shift and hit r.

If you havent already wrote a reply in a text file, hit enter when a message
pops up asking you if you have. It'll then ask you which editor it wants you
to use. Choose. Delete the header info, and type your reply. Save your
response then exit, then you will send this message by hitting s. It'll
ask you if you want to add your .sig file (signature). Select y or n .

To start a follow up to an article hold shift and hit f, this qill include
the message originaly posted. trn gives you a warning about posting
to loads of machines, and it tires to put you off, for some reason (Habanec
should have took the hint, not that he would use unix)but if you are confident
your contribution is meaningful hit y. Then Enter. You get the same rig-ma-role
you have when replying via email but you probably wont want to use one you
made earlier so hit return. Then it'll ask you which editor you wish to use.
Same thing as with the e-mail.

In this newsgroups list delete the newsgroups that wouldnt be interested in
your post, and move to the beginning of the article and start typing your reply.
Again, save your message, and send it.

Remember you dont need to only follow up to a thread, start your own one!

To do this type f when browsing the ng and do the same stuff as with replying
and following up.

You can also add a new news group if you want.. type

g news.group.name

I recomend (hesitantly) alt.ph.uk . Read it before you post!

Next section on this news section is dedicated to David Habanec, because
you will always hold a special place in my ...killfile.

A killfile is a file that tells your newsreader to ignore all posts from a
certain user. (Now you know why Habanec gets a mention)

A killfile does more than this, it also can delete messages automatically
you know you are not wanting to see. To add a command to your killfile Press
shift + k .

IRC

Irc is an increasingly popular medium, it is used for chatting with other
users, and can be fun and easy. The easiest irc ing program is ircii and its
big brother is BitchX.

To run ircii type:

$irc <servername>

or

$ircii <servername>

There are a lot of know it alls on irc, who usually dont know much at all.
However there are people who do know their stuff (#2600-uk crew).

On irc you use quite a few simple commands. These are as follows:

/join #channelname = makes you join a specific conference, channel names
                     always are preceeded by a # sign. My channel on
                     irc.chatnet.org is #helpnet and my nick is insanity,
                     for various irc related help.

/part #channelname = makes you part a conference.

/whois nickname    = performs the who is command on a user, to see which
                     channels they are in, which server they are on, and
                     what there user@host is.

/query username    = starts a private chat in a seperate window with a user,
                     and you use the same command to close it.

/ctcp version username = Sees what irc client a user is using.

/ctcp time username = sees what time it is on a users computer clock.

/who #channelname   = sees which users are a specific channel.

/list               = sees what channels are on the server.
 

There are more commands if you are a channel operator. (You have an @ beside
your name)

/mode #channel +o  nickname = Gives a user operator status.

/mode #channel -o  nickname = Removes a users operator status.

/mode #channel +b  *!*@*.hostname.com = sets a ban on users host.

/ban #channel nickname = same as above.

/kick #channel nickname reason = kicks a user from a channel with a reason.

/topic new topic
 

There are millions of commands for irc and its really a learn as you go
experience, just sit back and watch, but remember to contribute. If you
need any more help mail me.

Telnet Rlogin Etc

When you are connected to the internet, the chances are you will need to use
telnet etc one day to do something (more often that not for some people <g>)
You can use programs like telnet to connect to other computers and use them
as if their were your own, because any command you type while logged into
another machine is excecuted there. A (legal) example of this is when you log
into a shell. If you had a shell with the people at hobbition.org you would
use this command:

$telnet hobbiton.org

You are presented with login thing you see when you login to your UNIX.
If you already have a shell there type your user name and password, if you
dont type newuser at the login prompt. After you are done type logout so
the system knows you are gone, and you can get back to your own UNIX
prompt. You'll get a message like:

Connection closed by foreign host.

If the terminal you are connected to finds you beautiful it will not want you
to logout, so you need you use some persuasive force. (Ctrl + ] works) you'll
then be in control again, type quit at the prompt.

Another way to connect to a remote computer is rlogin, its usage is:

$rlogin systemname

UNIX will respond some messages but no name or password. This means your host
is accepted to use this particular machine, but be carefull, if an undesirable
type gets write access to your hosts.allow or hosts.uquiv file and adds his
host or ++ anyone can login without a user or pass, whether it be with telnet
or not.

There are other remote login type programs out there, but none will be in
more frequent use than these two, if you have any questions about them ask me.

Conclusion

Well this is the end of the file (Author ignores the cries of Hallelujah) and
I hope it has taught you to be comfortable with your UNIX interface. Remember
there are a lot of things I havent covered and if you have any problems mail
me, my (mailbox) door is always open.

Dedication

I would like to dedicate this file to the b0red. You all r0ck.

billgates@cia-agent.com

P.S I know this format i quit fscked up, if you want in plain text mail me.