• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

The AltOS FAQ

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.
Status
Not open for further replies.

David

Forums Super Moderator
Joined
Feb 20, 2001
*Just gonna use this as a thread to keep all the AltOS FAQs together*

I have often seen the same question answered many times, and I feel that a list of links, explanations etc would be useful. If anyone would like to see something added, feel free to add it, or email/pm me and I will post a description.

-----------------------------------------------------------------------------

LINKS
www.linuxdoc.org - Linux documentation project
www.linuxnewbie.org - Great explanations for newer users
www.linuxiso.org - download linux!

Linux is an open source OS - based on the linux kernel written by Linus Torvalds as a UNIX clone. Many of the programs - such as the shell, GUI etc are totally seperate from the actual linux. The correct term for linux is in fact GNU/Linux - acknowledging that it is actually the GNU OS using the Linux kernel.

Links
GNU - www.gnu.org
Linux - www.linux.org

-----------------------------------------------------------------------------

Linux comes in a variety of forms, called distributions. They differ only very slightly - in their setup programs usually.
The most popular ones are:
Redhat = www.redhat.com 8.0 is the latest
SuSE = www.suse.com 8.1 latest
Mandrake = www.linux-mandrake.com 9.1 latest.
Debian = www.debian.org 3.0 latest

All modern distros come with a GUI (pictures) - this is XFree86, currently at v4.3. This is the same is as used for Solaris and *BSD.

The best type? I personally use SuSE, but Mandrake is supposedly easier to use and debian has a far superior method of handling programs. However Mandrake, SuSE and Redhat are the best for newer users, if a little less flexible.


-----------------------------------------------------------------------------

Programs and Applications

Some Windows apps will run under Linux with some help - see www.winehq.org for more details. Linux comes with a vast array of its own programs:

Multimedia: Linux has facilities for burning CDs, making MP3s and comes with its own open source sound format (Ogg Vorbis). It can play CDs and DVDs, via programs like MPlayer.

Server: Funtions for file sharing. web serving, file serving, proxy serving, you name it. It can even act as logon server for Windows Clients via Samba. Clustering is also possible for CPU intensive tasks.

Internet: A variety of different web browsers and ftp clients, as well as email clients. Browsers include Konqueror, Opera, Mozilla, Galeon and Netscape. Email clients include Evolution, KMail, and pine.

Games: Loki games have ported a lot of windows favourites to linux - including Quake 3 and Railroad Tycoon 2. Linux also comes with many other open source games including Descent 1 and a lot of fun arcade games (tetris, etc). Unreal Tournament 2003 has a Linux installer on CD3, so you can frag on Linux right out of the box! :D. Unfortunately Loki Games has gone out of business, but there still should be some copies available, even second hand.

Graphics: The GIMP imho is the best graphics program for Linux. Also available is ImageMagik. Moonlight 3D and Blender enable you to build 3d graphics and scenes.

Development: Most linux versions come with gcc, for compiling java, C++ and C programs. Linux also comes with many editors, Development environments and HTML coding helpers, such as Electric Fence, Anjuta, KDevelop, etc.

-----------------------------------------------------------------------------

Command Line Hints and Tips
------------------

Get to know the command line - this is your most useful tool when things go wrong.

Directories
/ refers to the root directory - the top of the filesytem.
~/ refers to your home directory.
../ refers to the directory containing the current directory.
./ refers to the current directory
/tmp looks in the root directory for the tmp file or directory
tmp looks in the current directory for the tmp file or directory.

Navigation
To move to directories simply use cd, eg:
cd /tmp/mydir
To move directly to your home directory do:
cd ~/ (that is tilde ~, forwardslash /)
Or simply do:
cd

pwd displays the current directory.

Deleting and changing files
To create an empty file use touch:
touch myfile

To delete a file, use rm
rm myfile deletes the file: myfile
rm -r mydir deletes the file/directory: mydir and all files and folders in it.
rm -f myfile forces the system to delete myfile.

To create a directory use mkdir or md. For example, to create a directory mydir:
md mydir

To remove a directory use rm -r, rmdir or rd

-----------------------------------------------------------------------------

Users
There are two types of user:
- root, the system admin/superuser. This should only be used when absolutely necessary - misuse could seriously damage the system - he/she has complete access to the whole system.

- other users: These users have read access to all files except the documents of other users. They have write access to only the /tmp directory and their own home directory - where they store their own files and settings.

-----------------------------------------------------------------------------

Software

Software for linux comes in 3 main forms:

Tarred Gzipped Source Code
This is the source code tarred and gzipped, to compress it.Not all tar.gz files are programs, it is simply a packaging method. To install sofware in this form, copy it to a directory (anywhere that you have access to) and perform the following steps:

1) Log in - as a normal user or root user - it is unimportant

2) Go to the directory where the tar.gz file is

3) Execute the following command (x=extract v=verbose z=unzip):
tar zxvf mypackage.tar.gz

4) Look for the directory created, I will assume that the above example produced a directory called mydir. Go into it.
cd mydir

5)Type the following commands, in order:
./configure
make

This prepares the software to use.

6) Make sure you are logged in as root, or have root privelages, and type:
make install
This installs the software.

RPM Packages
These are packages of compiled software - each item of software often relies on other software - ie you need certain KDE core elements before installing the sound bits. These are known as dependencies.

These usually come as .rpm files.
Install them by doing:
rpm -Uvh myrpm.rpm

If you need to force the rpms to install regardless (NOT reccomended, except for Vcard drivers etc):
rpm -Uvh myrpm.rpm --nodeps --force

DEB Packages using apt-get

To install packages using the Debian distribution of Linux, use the apt-get program.

To install software using Debian, simply type:
apt-get install myprogram

To remove software using Apt-Get, use:
apt-get remove myprogram

Every so often, update the list of available software using:
apt-get update

-----------------------------------------------------------------------------

New to Linux? Choosing a Distro?
Linux can be obtained from www.linuxiso.org for free, but requires downloading.
I personally would reccommend buying a distro - support and manuals (and often some cool stickers ) are included.

SuSE Linux, my personal fav. - www.suse.com www.suse.co.uk
Linux Mandrake. - www.linux-mandrake.com
Redhat - www.redhat.com

These three distros are generally considered to be the easiest to use. There is also:

Debian Linux - www.debian.org
Slackware - www.slackware.com
TurboLinux - www.turbolinux.com
K12LTSP- distro contains RedHat 8.0 and adds an install option that will create a Linux Terminal Server. http://k12ltsp.org/contents.html

-----------------------------------------------------------------------------

Folding @ Home
Many of you may have heard of the Folding at Home project - see the Folding@Home section of the forums or http://folding.stanford.edu for more info. You can fold using linux - to do so, you need to do the following:

1. Copy the downloaded executable (from the folding@home website) to an empty directory - in a directory in /tmp is a good idea.

2. Change the permissions of the folding@home program to allow anyone to run it:
chmod +x <folding@home file>

3. Then run the program - you will need an active net connection, but only for sending and retrieving work.
./<folding@home program

Seti @ Home (Added by SpeeDj)

First browse over to here; Unix/Linux Client and download your appropriate client. Then do the following in a shell; tar xvf filename.tar

Now what follows is an excerpt from Seti @ Home's Site
NAME
setiathome - the SETI@home client program

SYNOPSIS
setiathome [options]

DESCRIPTION
setiathome is the UNIX version of the SETI@home client.
It downloads radio telescope data from a network server,
analyzes the data looking for signals of extraterrestrial origin,
and uploads results to the server, repeating this cycle indefinitely.
See http://setiathome.berkeley.edu for more information.

FILES
The program generates several files with .sah extension
in the directory from which it's run.
These should not be modified.

If you want to run multiple instances of setiathome
(on a multiprocessor machine, or on multiple machines
that share a filesystem) each one must be run in a different directory.
You can use symlinks for each directory to avoid duplication
of the binary image. e.g.:
ln -s cpu0/setiathome cpu1/setiathome

setiathome uses a lock file (lock.sah) to prevent
multiple instances from running in the same directory.

To finish up your current work unit, return your result, and not
download a new work unit, while the client is running, touch
a file named "stop_after_send.txt" in the client directory.
When the processing is finished, and the result sent, the client will stop.
*** Note this one file extension is .txt, while all other files used by the client have extensions .sah ***

The file "pid.sah" contains the process ID of the current instance.

RUNNING SETIATHOME
The first time you run setiathome it will interactively
ask you for email address, name, country etc.
This info is stored in a file and no interaction is
needed when you run the program subsequently.

After this you can run setiathome in the background,
and direct its output to /dev/null if you like.

setiathome can be freely stopped and restarted.
It saves its state in files, and will pick up where it left off.

If you want setiathome to be started automatically, you can
set up a cron job. Add the following line to your crontab:

0 * * * * cd <setidir>; ./setiathome -nice 19 > /dev/null 2> /dev/null

Where <setidir> is the directory where the setiathome client is installed.
This cron job will attempt to start the client at the top of every hour.
If it is already running, the next invocation will do nothing.
If the client is not running, it will be started.
For more information on cron jobs see the crontab(1) manual page.

The following script will stop all instances SETI@home:
(assuming the binary execution name is: setiathome)

#! /bin/sh
kill `ps aux | grep setia | grep -v grep | awk '{print $2}'`

(adjust the ps arguments for your system)

The following will stop the instance in the current directory:

#! /bin/sh
kill `cat pid.sah`

Please do not operate the client on machines for which you do not
have permission.

ENVIRONMENT VARIABLES

If the environment variable HTTP_PROXY is defined,
setiathome will connect through a proxy server,
specified as hostname or hostnameort.

If the environment variable SOCKS_SERVER is defined,
setiathome will connect through a SOCKS server,
specified as hostname or hostnameort.
If the environment variables SOCKS_USER and SOCKS_PASSWD
are defined, these will be used as the login name and password
for the SOCKS server. Otherwise setiathome will query you.

OPTIONS
-login
Login or create new account.

-countries
Show list of country codes.

-version
Show software version

-nice N
Set "nice" priority to N (default 1);

-email
Send email (to login email address) on errors.
Useful if you run in background directed to /dev/null.
This option is not available for all clients.

-graphics
Generate a data stream for the xsetiathome graphical interface
(see README.xsetiathome)
This option is not available for all clients.

-proxy hostnameort
Connect to SETI@home server via specified HTTP proxy server and port.

-socks_server hostnameort
Connect to SETI@home server via specified SOCKS server and port.
Overrides SOCKS_SERVER.
SOCKS versions 4 and 5 are supported.

-socks_user name
SOCKS user name.

-socks_passwd password
SOCKS password.

-stop_after_process
If a work_unit.sah file is present, process this work unit
and stop after processing is complete, do not return result.
If the client is started with this option, and there is
a completed result.sah file present, the client will first
return the results, then pick up a new work unit, process
to completion, then exit.

-stop_after_xfer
Return results and pick up a new work unit.
This option only functions if the result.sah file is present
and complete indicating that processing is finished for this
work unit. If a work_unit.sah is present, indicating processing
is not complete, no transfer or processing will be performed,
and the client will exit.
(see also: stop_after_send.txt mentioned in FILES above)

-verbose
print a running summary of the work being done.
Starting with the version 2.4 clients, the client is silent
to stdout during processing. There are messages at the start
and finish of processing a work unit, but there are no progress
messages printed during processing unless this option is used.

-nolock
omit the multiple-instance check, which uses file locking
(not available on some NFS systems)

KNOWN BUGS:
Outstanding shared memory segments and semaphores may be left
active in case of an abnormal exit of the 'setiathome -graphics'
process. These can prevent any future invocation of
'setiathome -graphics'. To resolve this problem, use 'ipcs'
and 'ipcrm' to remove shared memory segments and semaphores that
are not associated with a process. This behavior may vary
depending upon how your UNIX system handles this situation.
See also ipcs(1) and ipcrm(1)

For version 3.0 clients, the estimated progress as indicated
by the prog= line in the state.sah file in not exactly linear
in relationship to completion time. Using this value to
predict completion time may not be completely accurate.
The linear relationship will vary depending upon the characteristics
of the work unit parameters.

SEE ALSO:
There is much more information to be found about the operation
of the client at the following WEB sites:
http://setiathome.berkeley.edu/
http://setiathome.berkeley.edu/faq.html
http://setiathome.berkeley.edu/links.html
with discussions of add-on programs and scripts to control
the client in various situations.


-----------------------------------------------------------------------------

Installing Linux

You will need:
- a 200MB or so partition for swap space (swap)
- another partition, recomended 1GB or more. (for root partition, / )

The install program should allow you to format the partitions. Format the swap space as 'swap'.
For the second partition you will usually have the choice of one or more of these:

ext2 - 2nd extended file system
The main standard among linux distros - nearly every version of linux will give you this choice. It is widely supported but if the computer is shut down improperly, the file system has to be checked. (like scandisk, but for linux). Depending on the size of the partition this could take quite a time.

ext3 - 3rd extended file system
The newer ext fs - backwards compatible with ext2 (it can be used as if it was ext2, but its new capabilities will not be used in such a case). Ext3 is a journalling file system - it will log each and every change made to the file system. If the computer is shut down incorrectly, the file system knows automatically what has to be fixed - ie what files were open at the time. This makes restarting after a crash/power cut a lot quicker and more reliable.

ReiserFS
Also a journalling file system - not readable as any other file system. ReiserFS has journalling ability, saving time when rebooting after a crash. It has some issues with RAID arrays, unfortunately. Only RAID 0 is ReiserFS compatuble.

IBM JFS - Journalling File System
Not as widely used as the above three file systems, but it is also a Journalling filesystem, developed by IBM.

SGI XFS
A journalling filesystem by SGI, it is meant to be quite fast. It is not as common as the first three file systems. Originally developed for SGIs IRIX OS.



After choosing partitions you will need to choose packages to install. You will usually be OK with the default install - you can always add new packages later.

-----------------------------------------------------------------------------

GCC

To use do:
gcc helloworld.c -o helloworld
gcc <source-name> -o <output executable>


If no output filename is specified, a.out is default.

To run the file do:
./myprogram
eg:
./helloworld


-----------------------------------------------------------------------------

Originally posted by Drunkmonkey

About Linux and Modems
A problem many people come by with linux is there modem won't work. Their first reaction is "Linux is crap!" which is wrong, like this guy said(a link to another thread). Please don't be that kind of person.
What is most likely wrong with your comp. is your modem is a winmodem, notice the prefix: win. These modems let windows do all the work a regular modem should do to save you some cash but don't work without special drivers which can be found here www.linmodems.org . A non-winmodem is hard to come by these days, I started a thread asking for one that can be found here.

-----------------------------------------------------------------------------

Disk Imaging
In some situations you may want to image a file/partition to another file/partition. This can be done with dd, found in all Linux distros

dd can be used as follows:

dd if=<source> of=<destination>

Source/destination can be a file, or a device. Eg for the first partition on the secondary master drive to a file called backup.img:

dd if=/dev/hdc1 of=backup.img

You can also specify how much of it you want to copy over. Specify the block size, in bytes, and then how many blocks. For example to copy 100MB from the above example, try bs=1048576 to set block size to 1MB and then count = 100 to copy 100 of the blocks:

dd if=/dev/hdc1 of=backup.img bs=1048576 count=100


-----------------------------------------------------------------------------

Windows Filesystems in Linux

  • FAT32 - Linux has full FAT32 read and write abilities, and will work fine with windows FAT32 partitions.
  • NTFS - Most distributions*, by default, the ability to read NTFS partitions built into their kernel but not to write to them. Write support can be turned on (requires changes to kernel config) but will damage the filesystem, so that Windows will go crazy next time it boots.

*depends on your distro. NTFS read and write support can be turned on and off manually.

-----------------------------------------------------------------------------

Setting Up DHCP server

This is a quick guide on setting up DHCP for a small network. On my network I run DHCPd on my machine for another machine (win95) to use.

1) Make sure the ISC DHCP server is installed.
2) Type route add -net 255.255.255.255 dev eth0 where eth0 is the network card connected to the network that the DHCP server is to run on.
3) Edit/create the /etc/dhcpd.conf file put the following in it:

default-lease-time 3600; # in seconds
max-lease-time 36000; # seconds
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1; # routers
option domain-name-servers 62.31.64.115, 62.31.64.116; # your dns servers
option domain-name "blueyonder.co.uk"; # your domain just use any domain name
ddns-update-style none;

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.2 192.168.0.10;
}


Replace IP addresses with relevant ones for your network.

Then run dhcpd eth0 where eth0 is the interface you want DHCP to run on.


-----------------------------------------------------------------------------

Setting up a linux rig to allow other machines to use the net through it

This will allow all data connections out, but only requested data connections in.

Run the following commands:
# Modules
depmod -a
modprobe ip_tables
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
modprobe iptable_nat
modprobe ip_nat_ftp

# Enable forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4 /i p_dynaddr

# IPTables
iptables -P INPUT ACCEPT
iptables -F INPUT
iptables -P OUTPUT ACCEPT
iptables -F OUTPUT
iptables -P FORWARD DROP
iptables -F FORWARD
iptables -t nat -F

iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -j LOG
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


eth0 = external interface
eth1 = internal interface
This is for a 2.4.x kernel.

That worked for me: set the gateway on the clients to the IP address of the linux rig.


-----------------------------------------------------------------------------

Originally posted by phantom punisher

How to install a GeF4Ti4200 in mandrake 8.2 and 9.0

ok this was,as all linux undertakings, a big run around so ill give a step by step the best i remember

1. Install mandrake 8.2 with the default video configuration. Make sure to pick to install chromium the game

2. Once you make it all the way to the desktop you can exhale. go to nvidia and get:
nvidia_glx-1.0-2960.i386.rpm
nvidia_kernal-1.0-2960.mdk82(smp if you need it).i586.rpm
Download the file "mc-4.5.55-9mdk.i586.rpm" from mandrake cooker and put the three files in the root directiory or somewhere you can find them from the terminal.

3. Install mc-4.5.55-9mdk.i586.rpm. its midnight commander text editor and it wil make life tollerable in linux terminal.

4.Edit the file /etc/inittab and find the line that reads id:5:initdefault:
Change the 5 to a 3. This makes it stop at the terminal and not auto start the xserver.

5.Reboot and log in as root(you should be in terminal) remember linux is case sensitive!
Cd into the directiory with your rpms
Typerpm -ivh NIVIDIA_k.(hit esc twice and it will complete it for you) then press enter.
Type rpm -ivh NVIDIA_G (hit esc twice) then press enter.

6. Now type XFdrake or FXdrake (?) and choose the nvidia generic geforece 3 card. it should give you an option of withch free86 you want. choose 4.2 and follow the install directions(ex:instert cd1 press enter) remember to say no to any testing or starting x after reboot. Say yes to keep configuration making sure that xfree86 4.2 is shown.

7. Reboot and log back in as root. do the whole xfdrake thing again making all the same selections.

8. Now we edit the xfree86config-4.
Change directory to find the file at /ect/X11
Type mcedit XF86Config-4 (big blue screen comes up)
Now look for the line that says Load "dbe" and add underneath Load "glx"

9. Now find the graphics device section in the config
Change the lines to look like this
section "device"
identifier "NV AGP"
blah blah blah
driver "nvidia"


10. Now find the screen sections
Change it to look like this
section "screen"
identifier "screen1"
device "NV AGP"


11. Now press f2 to save and then f10 to quit.

12. Now type startx and you should boot into kde. try any game that is opengl (like chromium) if it works you're all set. i dont know why there is no nvidia spash screen.


-----------------------------------------------------------------------------

Originally posted by SpeeDj

For Linux Gamers

Just found a site today that's called Transgaming, they make what they call WineX which is wine with some DirectX support mixed in. You should check it out and see what they have to offer. I haven't really delved in too much but there success with quite a few games gives me hope that all is not lost as of yet.

J

http://www.transgaming.com/ That is the site
 
Last edited:
The reason this thread is locked is to keep chitchat out of it. If you have well thought out and well formatted and written material you'd like to put in here, PM myself of Unseen or SpeeDj.

SickBoy
Forums Moderator
 
Samba Howto

Part 1:

Lots of people seem to have samba questions in here, and many of the existing guides assume the reader has prior Unix knowledge. So this is my version, geared for some one just starting out.

What is Samba?
Samba is a program designed to allow *nix to serve windows file and printer shares.

I'm not going to cover installation of samba, mainly because most distributions install it by default.

The first thing you need to do, assuming you have samba correctly installed, is to locate your smb.conf file. Generally, this is located in /etc/samba/. If you can't find it there, this is how you can locate it:
as root, run:
slocate -u
this will build a database of the files on your system, and will take a while. After its done, run:
slocate smb.conf
and it will tell you where to find it.

Samba, like many *nix programs, is configured via a text file, in this case, smb.conf. To change the way the Samba server behaves, you change this file.

Before we actually get start configuring Samba, we must do some preparation for the system. First, let's create a user that we will use for our Samba adventure. First, make the user with the useradd command, like so: (as root of course)

useradd -m username

The m argument tells the system to build a home directory for our new user, at /home/username. This is generally a good idea, but its up to you.
We will also set a Samba password for our new user, but that requires the Samba server to be running, so we'll wait on that for a little while. Note that this is different from a regular user password.

The username should be the same as the username of the windows computer you want to share with. The Samba password also will be need to be identical to the Windows password of that user. You can also make a share public, and available to all users, but we will deal with that later.

Some distros use a default hostname of “localhost.” This is not good, because when a Windows machine attempts to connect to a Samba server calling itself localhost, it interprets that name to mean the loopback
address. The Windows machine thinks that the Samba server resides on itself, and any attempts to connect to it will fail. This problem can be fixed by instructing Samba to use a different NetBIOS name. We will handle this when we begin to write our smb.conf.

If you'd like to change the actual hostname of your machine, consult your distribution's docs.

One quick note: For all our text editing purposes, we will be using pico. I find its interface to be easy to use and intuitive, unlike vi or emacs. You're free to use your editor of choice, of course.

Now we're ready to jump into smb.conf. The basic format of smb.conf consisted of keys, all under groups. It looks like this:

[group]
key = value
[another_group]
another_key = value

Pretty straightforward. A very basic smb.conf looks like this:

netbios name = SAMBA
workgroup = MYGROUP
[homes]
guest ok = no
read only = no

This brings up something very important: workgroup. If you workgroup is not exactly the same for all computers you want to have access to, none of this will work when you try to access it from your windows box.

Also note that we've overridden the Samba default of using our hostname as our NetBIOS name, and have called our server “SAMBA” instead. This deals with the aforementioned localhost issue. Feel free to call your server anything you choose.

Change into your samba directory (cd /etc/samba or whatever your
directory is) and use pico to create that smb.conf file for now. If you have a sample or existing smb.conf file, rename it so you can use it later (do it like so: mv smb.conf smb.sample.conf). Now, lets test our Samba configuration.

Let's test our smb.conf syntax first. Type testparm and look at what it returns. Testparm checks the smb.conf for syntax errors and such, and I suggest running it right after you've made any changes to your smb.conf. If there are any errors, it will tell you and you must fix them before continuing.
 
Part 2:

Secondly, start the two samba daemons. As root, run:
/usr/sbin/nmbd
/usr/sbin/smbd
It's possible your daemons are somewhere else, if so, just do a slocate on them and you'll find them. Make sure that the two processes are running by typing the following:
ps ax | grep mbd
You should see nmbd and smbd (and possibly some others, just ignore them) in the list. If you do, your daemons are running, and we can continue to the next step.

This is a good time to set up your user's samba password. This is done with the smbpasswd command, as root. The basic syntax is:
smbpasswd -a username password
If you want a blank password, use the n (as in null) argument like this:
smbpasswd -an username

Note that if you use null passwords, your smb.conf should have the following under the [global] section:
null passwords = yes

Now, lets make sure that your NetBIOS name is working correctly. Type the following command:

nmblookup NETBIOSNAME
of course, replace NETBIOSNAME with your NetBIOS name, which was set in your smb.conf file. If you didn't set one their, use your box's hostname . You should see something like this:

querying NETBIOSNAME on 192.168.123.255
192.168.123.176 NETBIOSNAME<00>
The IPs are for my network, yours may differ. As long as there aren't any errors, let's continue.

To confirm that you can log in, use the following command:
smbclient \\\\HOSTNAME\\username
Samba should ask you for your password and 'log you in' to your home directory.

Now, you may notice that if you try to get access to your file from a Windows box, you'll get an error message. Yet, smbclient is able to use the server perfectly, how could this be?

Newer versions of Windows require password encryption for SMB shares. They will refuse to talk to a server that does not support password encryption. Unfortunately, the Samba default is to disable this feature, so we must explicitly enable it in our smb.conf.

In addition, you may also have problems connecting if your Windows user and password do not match your Samba user and password. A quick way to fix this is to make your shares accessible to all users. (Note that the better fix is to simply change the passwords and usernames so they match).

Finally, although the method of sharing the Samba user's home directory works well for simple examples, most users have specific other directories they want to share. We can do this in Samba as well, by declaring a new share in the same way we declared the first.

Note: This has the potential of causing permissions issues. If the Samba user cannot access a file, neither can the Samba server. A quick fix, if this happens, is to give the directory in question full permissions for anyone, like so:
chmod 777 -R /target/directory/here
This is a quick fix, and not a good idea for security. The *nix permission system is out of the scope of this document, but I highly suggest learning how to use it if you want to use Samba seriously.

Let's write a smb.conf that has password encryption and declares a public share, in addition to home directory sharing.

netbios name = SAMBA
workgroup = MYGROUP
password encryption = yes

[homes]
guest ok = no
read only = no

[public]
path = /usr/some/public/dir
public = yes
guest ok = yes
writable = yes
printable = no

Make sure to replace the path of the public share to something else, and then save this as your smb.conf. Run testparm, ensuring there are no errors. Then, in order for your changes to take effect, tell the Samba daemons to re-read their configuration files:

killall -HUP nmbd
killall -HUP smbd


The changes should be be reflected if you use smbclient, or if you access the server from a Windows box.

Now that we have the basics down, use the sample smb.conf file and read the comments in it; there is a lot of information in there. Try editing the file yourself and experiment with the various features.

For reference, here is my smb.conf file:
 
Sample smb.conf

#======================= Global Settings =====================================
[global]


workgroup = YOUR_WORKGROUP_HERE
server string = Samba Server
hosts allow = 192.168.123.185 192.168.123.118 127.
load printers = yes
log file = /var/log/samba.%m
max log size = 50
security = user
encrypt passwords = yes
ssl CA certDir = /etc/ssl/certs
socket options = TCP_NODELAY
interfaces = 192.168.123.176
dns proxy = no

#============================ Share Definitions ==============================
[homes]
comment = Home Directories
browseable = no
writable = yes

[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes

[public]
path = /home/master
public = yes
only guest = yes
writable = yes
printable = no

[www]
path = /var/www/htdocs
public = yes
only guest = yes
writable = yes
printable = no
 
Part 3:

If you use this file, be sure to change the IPs and the workgroup to reflect your network. Also, alter the share definitions to the directories you want to share. Note that this configuration is not terribly secure, as anyone on the network has full access to the shares.

At this point, if you smb.conf is set properly, you should be able to see your Linux server on the windows machines. If you have problems creating, editing, or viewing files, it is probably a permissions issue. You have to ensure that your samba user has the permissions you want people connecting to the machine from Windows to have. For example, if you want to make a directory and all files beneath it have full read/write access for everyone, use the following:
chmod 777 -R /path/to/directory
(as root)

For individual files, remove the -R. Try man chmod to get more information on permissions.

Permissions should not be an issue if you are sharing the samba user's home directory. This is a good way to start out.

You may want samba to start automatically on boot. The procedure for doing this tends to vary between distros. I'll try to cover some popular ones here.

Mandrake 9.1 (should work for most Red Hat based distros):

If you are using X Windows (GUI), open up Mandrake Control Center. Goto the System tab, and click on DrakXServices. Find the smb service in the list, and ensure the On Boot checkbox is checked. Then click OK and restart the system.

Alternatively, you can use the command line. Type the following commands (note that if you are told “File exists,” it shouldn't be a problem):

ln -s /etc/init.d/smb /etc/rc5.d/S91smb
ln -s /etc/init.d/smb /etc/rc0.d/K09smb
ln -s /etc/init.d/smb /etc/rc6.d/K09smb


If your default runlevel is something other than 5, change the number in the first line to reflect that.

Gentoo:

Firstly, make sure you've installed samba by running
emerge samba
After that, run the following to make Samba start on boot:
rc-update add default samba

To check if Samba is running after rebooting your machine, ensure that the following command prints two lines, one for nmbd and one for smbd:
ps ax | grep mbd

Finally, when troubleshooting problems, the most important thing to check is your physical network. Make sure the machines can ping each other, etc. Then, use nmblookup to see if NetBIOS is working correctly, and finally try logging into the server with smbclient.

Alright, I think I covered the basics here. If anyone has any suggestions, comments, or anything, feel free to post or PM me. Here are some links to more Samba info:
http://samba.linuxbe.org/en/index.html
http://www.troubleshooters.com/linux/samba.htm
http://www.linuxfocus.org/English/March2002/article177.shtml
http://k12linux.mesd.k12.or.us/using_samba/
http://www.tldp.org/HOWTO/SMB-HOWTO.html

And my personal favorite for problems you can't seem to find a solution to:
http://www.google.com/linux
 
Status
Not open for further replies.
Back