Panther Moderns: A Beginners Guide To UNIX
NOTICE: TO ALL CONCERNED Certain text files and messages contained on this site deal with activities and devices which would be in violation of various Federal, State, and local laws if actually carried out or constructed. The webmasters of this site do not advocate the breaking of any law. Our text files and message bases are for informational purposes only. We recommend that you contact your local law enforcement officials before undertaking any project based upon any information obtained from this or any other web site. We do not guarantee that any of the information contained on this system is correct, workable, or factual. We are not responsible for, nor do we assume any liability for, damages resulting from the use of any information on this site.
A Beginner's Guide To Unix
The information contained in this file
is by no means new or original. I was
simply asked to compile some basic
commands and concepts for the access
and use of Unix systems. I would like
to give credit to the many other files
which I have gained this information
from, and to the people who have helped
me learn what I know today.
I will not cover any detailed or
complicated features of Unix. I am
merely going to provide the means to
access low-security systems and
navigate the shell.
All Unix systems are provided with
default accounts. They are used for
system administration and such. Many
system operators are too lazy or naive
to remove them. You may find the
following accounts on a system, with no
Others may have been added, such as:
You can also try common first or last
names (john,fred,smith,etc...). Be sure
to use lowercase for the login name. If
you enter a capital letter as the first character, the system will assume that
you terminal is incapable of displaying
lowercase. From then on, in order to
enter capital letters you must precede
each by a "\". This can become quite
annoying, and you will probably never
see an account with a capital letter as
the first character.
Of the above defaults, the uucp or
nuucp accounts are often used for Unix
to Unix communications (uucp stands for
Unix to Unix CoPy). If this is the
case, the system will give send the
uucp identifier, "Shere". In this case,
the account is basically useless
unless you can call via another system
through the uucp command.
The sync account is a self-running Unix
management account. If present, it will
run a few housekeeping chores and log
off. The only reason I included this is
that many systems provide a greeting
message or something of the sort when
you log on as sync. Occasionally you
can obtain information which will help
you find an account.
If you cannot get in via the above
methods, try using "who". If present,
it will display a list of all accounts
currently online. You can try those
and hope they have no password.
If you are desperate, just hack
blindly. Often the login name and
password are the same. You can also
try initials (as in names...rlb,jhs,
Once you are in:
If you make it through the front door,
you do not necessarily have access to
the shell. Often accounts have programs
run automatically for specific users,
such as system administration programs
(useful), accounting programs, etc...
In this case, you can try to break out
of the program (either through a menu
option or a loophole). Try various
escape/break related control characters
(escape [ascii 27], ctrl-c [ascii 3],
When you are in the shell, you will be
greeted by one of two prompts. Either
a "$", denoting basic access, or a "#",
denoting superuser access. If you have
superuser access, most of your work may
be done (depending on other security
measures that have been taken).
Either way, the following will help
you get higher access.
First, you'll need some basic commands
for moving around:
This command sets your terminal
characteristics. Before you attempt
anything else, you should set some
important ones. First, your delete
character. Many systems do not use
the common ctrl-h [ascii 8]. Also,
the delete on your computer may not
be the standard ctrl-h. To set your
delete character, type:
stty erase (character)
Do not use the parentheses. Spacing
is important. You can replace
(character) by hitting your own
delete key, or typing a control key
If you would like to enter something
a bit more visual to reassure
yourself, you can use:
stty erase \^(character)
To enter a control character without
actually hitting control. Replace
character with the desired control
stty erase \^h
Sets the erase character to ctrl-h.
If you make a mistake doing this,
hit return and start over
(obviously if the system does not
know your erase character, you
cannot edit your mistakes).
Once your control character is set,
you will want to set your break
character. This is vital for file
editing, which we will cover
shortly. To set the break character,
stty intr (character)
The same options as the delete
To view the current setting, simply
enter stty by itself. Often, the
system will already be configured to
your liking. Occasionally, the stty
command will not display the erase
or break (intr) characters, in which
case you should enter them to be
sure. All control characters will be
displayed in the ^(character)
This is the list-files command. It
will show the names of all non-
hidden files in the current
directory. The display will either
be a single list or multi-column
display. The command lc toggles
between the two. In either case, the
files will be sorted alphabetically
(numbers first, followed by most
punctuation symbols, then capital
letters, and finally lowercase
ls has many options, which I will
Displays the current directory path
from the root directory (/).
Change directory. Those familiar
with the MS-DOS environment will
have no trouble with this command.
To change directories, simply supply
a path from the root directory.
To go to the "lib" directory, within
the "usr" directory, you would
Displays a file. Often it is
difficult to differentiate between
text files and data files. If you
wish to abort the display, type
your break character.
Cat requires the full pathname to
access files outside the current
directory, but for files within
the current directory, the filename
Will display the passwd file within
the etc directory. This file is
present on all systems. It is
immensily useful in gaining higher
access (basically, it is necessary
to gain any access).
These commands will help you for now.
After setting your terminal options,
We will be doing most of our work in
there for the time being. You should
have had your buffer on long before
this on the system, but turn it before
executing the following command if you
Often these files are quite large, so
after a while you may want to abort it.
Often what you are looking for will be
within the first few lines.
Each line of the passwd file represents
an individual user. There are seven
fields to each entry. A typical entry
looks like this:
The first field is the login ID. The
second is the password field. In newer
releases, it will contain an "x". Older
releases may contain the actual
encrypted password (a string of
seemingly random characters). On new
systems the encrypted password are
found in the /etc/shadow file. The
third field is the user ID number.
Fourth is the group ID number (more
on groups later). Fifth is merely a
comment about this user (often their
name, or in an administrative account,
its duties). Sixth is the home
directory. The system will place you
in your home directory when you log on.
The final field contains the path and
file names for the default shell or
program. If this field is empty, the
system defaults to /bin/sh.
You cannot gain a user's password via
this file. You may be able to obtain
access through a higher account,
however. When looking for high-level
accounts, you will want to examine the
fourth field. The lower numbers often
denote administrative accounts. The
group "root" belongs to is most likely
what you will want.
To discover more about the groups, view
the /etc/group file. This contains the
group names, the encrypted password
required to change into/out of this
group (almost always "NONE"), the group
ID number (to compare to the passwd
file), and a list of the group's
You will want to scan the passwd and
group files to find any accounts that
belong to the same group as root, or
a group which root is in. Often root
will be the only member of its group,
so you will have to look for other
administrative account groups (those
containing such accounts as adm,admin,
sysadm,sysadmin and so on).
Once you have found these accounts,
you can attempt to gain their access.
su (login ID)
allows you to essentially "become" that
user. Replace (login ID), of course,
with the account you want to assume.
If the account has no password, the
process is automatic. Otherwise, you
will be prompted for a password. You
can try the login ID as a password, but
this may not work. If it does, make a
note of it. Otherwise, you can try
other methods, or go on to another
Hopefully, you will find an account
with no password. If you have found
an older system, without the
/etc/shadow file, an empty password
field (::) will tell you immediately
which accounts do not have passwords.
If it is a newer system, it will
contain an "x" regardless of the
presence of the password status.
If you find yourself in this dilemna,
you may still be able to find an list
of those accounts without passwords.
If you have the superuser ("#") prompt,
you may be able to read the /etc/shadow
file. The format for this file is:
login ID:(encoded pw):6480:14:28
The first field is the same as the
login ID found in the /etc/passwd file.
Each entry in /etc/passwd should have
a corresponding one in /etc/shadow. The
second field will be blank, denoting
no password, or contain the
afformentioned "random" characters.
Third is a numeric code describing
when the password was last changed.
Fourth and fifth are the minimum and
maximum number of days between
mandatory password changes. Often the
last two fields are empty, which means
users are not required to change thier
Here, again, you should look for any
accounts without passwords, and
examine the group file as mentioned.
Now, hopefully, you will have some
decent access. Many of the accounts
with no password are that way for a
reason - they do not allow shell
access; but that never stopped anyone.
If you discover an account that runs
a program and then logs off, or runs
a program which allows you to
interact in a boring way, you can use
this to your advantage. Look in the
seventh field of this account's passwd
information. It will contain the
path and filename of the program being
At this point, security on most systems
is extremely low. Many system operators
are sure that by stopping you from
directly getting access, they have
stopped you totally. By "tricking" the
system, you can get access indirectly.
If you find a program being run, go
back to the account which gave you
shell access. Then enter the directory
where the program was (do not include
the file "/" and the filename). You
want to change the filename of the
program. To do this, type:
mv (filename) (backup filename)
To change /usr/prog to /usr/prog.b, you
mv /usr/prog /usr/prog.b
Make sure you remember the filename
you give it. It is also a good idea
to keep it in the same directory. Now,
you have to create a dummy file to
replace it. We will have to use the
"ed" file editor to do this. MAKE SURE
YOU HAVE SET YOU BREAK CHARACTER. You
cannot use ed without having a break
character. To make the file, type:
Where (filename) is the name of the
file you just renamed. Use the OLD name
(the one in the passwd file)! ed will
meaning the file does not exist yet.
Some basic ed commands are:
Quit. If you attempt to quit after
making changes, ed will not quit
until you hit "q" again (this is to
remind you to save changes).
Write file (saves all the changes
Displays all lines.
Searches the buffer for (string),
and displays that line.
Add lines (starting at the current
Insert lines at the current line.
Delete the current line.
Turns help on (shows verbose error
Entering a line number will bring you
to that line. When editting a file
which already exists, ed will show you
the current number of bytes in the file
rather than "?(filename)". If you
attempt to write a file, and ed replies
with "?(filename)", you do not have
access to write that file.
Now, back to the dummy file. Type "a"
to add lines. Enter:
Then, after pressing return on the
/bin/sh line, type your break
character. Write the file and quit the
editor. You now have your dummy program
set up. The command "echo" is a simple
print command. You can enter as many
as you like, or none at all. They are
merely to reassure you that your
program is running. The important part
of this is the "/bin/sh", which runs
the shell program.
You must now give all users access to
your program, so the account will be
able to use your newly created
This will give read, write, and execute
permissions to all users (more on
permissions some other day).
You should now logon again as the
account which uses this program.
If you did everything right, you should
now have control of the shell,
hopefully with superuser access ("#"
prompt). If you still do not have
superuser access, go back and try
something else. Be sure to do the next
few steps whether it works or not, to
insure your continued use of the
system. Delete your dummy program by
Be sure to include the directory path
in the filename, as before. Now,
rename the old file back to its
original name (just reverse the
filenames in the previous rename
Now everything is back to normal. If
you did not get access, you will have
to go back to your old account to set
the files back to normal. Make sure you
do this, or you may cause damage to the
system. This will result in higher
security. Also, real hackers never
damage systems for without cause.
Laziness is not an excuse.
If you are still without decent access,
you will have to consult another file.
I may write another soon on more ways
to gain access, but for now, this
should help enough people. From now on,
I will assume you have achieved
superuser access within an
administrative group. You will most
likely want an account of your own now.
Use the ed command to edit the
/etc/passwd file. Somewhere in the
mid-beginning section (within the first
4-12 lines), add an account using one
of the default account not already
present (from the first list, if
possible), or commandeer an unused (be
sure it is unused) default account
Set you ID number and group to those
of the root account (usually 0:3).
Set your directory wherever you like,
and set the shell filename to either
/bin/sh, or leave it blank. In the
password (second) field, what you
enter depends on the system. If it is
an older system where the encrypted
passwords are stored in the passwd
file, just enter whatever password you
like there. The system will encrypt it
for you when you save it. If it is the
newer "x" system, put an "x" there, and
do the following, otherwise skip this.
New system users will have to enter
This command will recreate the
/etc/shadow file based on the
information in the passwd file. Just
to be sure, ed the shadow file, and
leave the password field blank for
your newly created account (use the
/(string) command within ed to jump
directly to your login ID).
Now, you can call back as your new
account. You should enter:
to create a password for your account
if it doesn't already have one.
If all has gone well, you now have an
account of your own. I will now give
a list of other commands which you can
play around with.
This is a "fun" command, which will
take (string) and expand it into
block letters on your display.
Will send a message to another user.
After entering the command, the
system will wait for you to type a
message and terminate it with your
eof character. Change your eof
character by entering:
stty eof (character)
Like write, but sends to all users.
Displays a list of everyone online.
Send email to any user in the passwd
file. To read your mail, just type
Logout of the system. I should have
mentioned this before, but I forgot.
You can also use your eof
character at the shell prompt to
Prints text or variables, as shown
Display all variables in your
environment. More on shell
Delete a directory.
Make a directory.
cp (original) (backup)
Copy a file.
grep (string) (filename)
Searches through (filename) until
it finds (string), and then
displays the entire line (string)
was found on.
date (time & date)
Alone, date displays the time and
date. It can also be used to set
Alone, cal displays a calendar of
the current month. With optional
month and year, it will display
any year from 1 to 9999.
There are many more commands, but to
explain them all could take forever.
Most systems contain online help files
which you can access by typing either:
For a list of commands, look in the
various "bin" directories. They
contain the actual programs.
The shell allows the use of variables.
All variables are represented by
capital letters. You can create your
own, or view/change standard system
variables. Some standard variables are:
This will show the order the shell
searches in to find commands. You
will most likely find a number of
directories ending in "bin". An
example could be:
This means that when you type a
command, the system checks to
directories in that order before
finally giving up and reporting an
error if the command is not found
(All commands are files).
This is the main shell prompt,
usually "$" or "#", depending on
your access. You can change this
to whatever you like.
Some systems keep track of what
type of terminal you are using, for
use in formatting output (usually
through other programs).
The login ID you are using.
Your home directory.
The file your mail is sent to.
There are others, but they tend to vary
with the account. Enter the env command
to display the variables in use.
Variables you create within shell
programs (such as the dummy program
that was discussed before) retain thier
values for the life of the program
only (they do not affect the other
You can change a variable like this:
Whenever you want to view a variable,
or use it for another purpose, precede
it with a "$". Ex:
will display your login ID.
I seem to have run out of memory, so
forget it for now. Hopefully I'll write
so more soon...
- Midnite Raider
 Tfiles: (1-8,?,Q) :