Upload
hoodadada
View
248
Download
1
Embed Size (px)
Citation preview
8/4/2019 Samba Server Step by Step
1/44
Samba Server Step by Step
1 . In t roduc t ion1.1 What Samba i s?1.2 What Samba can do?1.3 Di f fe ren t componen ts of Samba s e rve r su i t .
1.3.1 Samba ser ve r s core component s - smbd & nmbd.1.3.2 Samba s erve r con f igu ra t io n f i l e (smb.con f) . 1.3.3 Ut i l i t i e s fo r samba s er ve r.
1.4 Configur in g Samba se rver us ing - swat1.4.1 What i s swat?1.4.2 How to s t a r t swa t s e rv ice s ?1.4.3 Confi gu r i ng Samba serve r s GLOBALS sec t i on
(smb.conf)
1.4.4 Crati ng Samba Password database 1.4.4.1 How to add new user to Samba passwordda tabase?
1.4.5 Cr at i n g sh ar e d r ec ou r s e1.4.5.1 Shari ng Server s CDROMDrive
1.4.6 Star t i n g smbd & nmbd demons1.4.7 Samba serve r in Action
1.5 Sha r i n g Pr i n t e r s1.5.1 Pr in te r i s connec ted to Another Windows Sys tem1.5.2 Pr i n t e r i s conne c t ed t o L inux Ser ve r i t s e l f
1.6 Resources
1 Introduct ion
Most of t he ne two rk s ba si c use i s f i l e s & pr i n t e r sha r i n g.Genera l l y in windows network ing we have MS-DOS, MS-Windows 95/98as c l i en t s machine and Windows NT as se rver , toge th er theyforms Microsof t windows NT network.
1
8/4/2019 Samba Server Step by Step
2/44
Fig.1 : Microsof t Windows Networki ng Setup
But when we would l i ke to use Linux as server and windows 95/98as c l i en t s us ing Microsof t windows NT l i ke network we need touse speci a l program to emulate Windows NT on top of Linuxserve r , th i s can be done us ing Samba. Th is i s r equ i red becausewindows and Linux can not exchange the da ta d i rec t ly . In themos t o f the ne twork env i ronment we use d i f fe ren t ope ra t ingsys tem fo r ve r i ty o f works and mos t o f us need to sha re ou rf i l e and p r in t e r s f r om di f f e r e n t works t a t i o n s l i k e MAC, Linux,Micro so f t Windows 9x/Me/XP/NT/DOS, OS/2, Novel e tc.
This part of document shows you how to confi gu re samba serve rusing swa t - web admin i s t ra t i on too l fo r Mic roso f t Windows9x/XP/NT Os.
1.1 What Samba is?
Samba se rve r i s L inux ' s imp lemen ta t ion o f Mic roso f t ' s WindowsNT f i l e & pr i n t se rv e r. I f you want t o us e f r e e Fi l e & Pr i n tse rver for your Windows 9x Cl ien t then i t s good choice . Sambauses the SMB (Server Message Block) pro toco l , which is used byWindows NT.
1.2 What Samba can do?
2
8/4/2019 Samba Server Step by Step
3/44
You can sh ar e f i l e s & f o ld e r s be twee n Linux and r e s t of windows cl i en t s incl ud in g windows NT Server/Workst a t i on.
Sha r i ng of Pr i n t e r s a t t a c he d t o Linux se rv e r or any o f the windows c l i en t computer .
Authenti ca t i on ( l ike Windows NT Domain server) forwindows cl ients .
1.3 Diff e r en t components of Samba serversui t
Samba se rv e r i t s e l f div i de d i nt o di f f e r e n t prog rams l i ke
Core component s of samba (smbd & nmbd).
Samba conf i gur a t i on f i le (smb.conf).
Ut i l i t i e s fo r samba s er ve r .
Documentat i on for samba.
Le t s look a t them step by s tep:
1.3.1 Samba ser ve r s core component s:
(a) smbd daemon :
I t s i s t he s er v e r daemon, whi ch i s us ed f or :
Fi l e s & fo l de r sha r i n g
3
8/4/2019 Samba Server Step by Step
4/44
Pr in t i n g sha r i n g
Use r au t he n t i c a t i o n
smbd can b e con t r o l l e d us i ng spe c i a l con f i gu r a t i o n f i l e ca l l e dsmb.conf.
(b) nmbd daemon :
I f you eve r used windows l ike ne twork then you a re fami l i a rwith Network Neighbor hood which i s used to s ee a l l compu te rconnecte d to your network. nmbd daemon is used to show Linuxserver (Samba Server) in to your Network Neighborhood's browser
l i s t . I t s a lso know as NetBIOS nameserver which providesnamin g se r v i c e s t o i t s c l i e n t compu te r . Withou t t h i s you can ' tsee Samba se rver in to Network Neighborhood .
TIP: You can s ta r t / s top above daemon from /etc/rc.d/init.d/smbscri p t . For e.g. To s ta r t the samba daemon type the command /etc/rc.d/init .d/smb start on your te rmina l .
1.3.2 Samba server conf i gura t i on f i l e
(smb.conf)
"smb.conf" i s t he main Samba se r ve r con f i g u r a t i o n f i l e . Thi sf i l e div i de d in t o di f f e r e n t sec t i o n s, most of t he sec t i o ndes c r i b e s t he sh ar e d r es ou r c e s l i k e CDROMd r iv e, Pr i n t e r e t c.I n o rd e r t o use you r samba s e rv e r you n eed t o ed i t andcon f i g u r e t h i s f i l e . But smb.con f f i l e can b e con f i g u r e d andadminis t e r ed by the swat p rogram. Swat runs f rom any webbrowser.
1.3.3 Ut i l i t i e s fo r samba se rv e r
Thi s i s th e se t of ut i l i t i e s which can be used t o browsewindows share f rom Linux or to d iagnose Samba conf i gura t i one rr o r s . Fo l low ing ar e some of t he u t i l i t i e s :
4
8/4/2019 Samba Server Step by Step
5/44
smbpasswd - Use to manage samba se rve r s password.t e s t p a r m - Use to t e s t smb.con f con f i g u r a t i o n f i l e . I t che ck sthe pa rame te r s in smb.con f f i l e .t es t p r n s - Use to t es t pr i nt e r con f ig u ra t i o n .smbcl ie n t - To open windows share from Linux server i .e. SMB
c l i e n t .smb ta r - I t s p rog ram to backup the f i l e s f rom any windowsc l i e n t .
1.4 Confi gur in g Samba Server using swat
As men t io n ed ea r l i e r , we a re go in g t o us e swa t t o con f i g u r e t hes amba s e rv e r . Swat i s t he pa r t of samba d i s t r i b u t i o n . Bu t byde fa u l t swa t i s no t i ns t a l l e d on Red Hat Linux 7.3, i n or de r t o
in s ta l l swa t you need to pu t Red Hat Linux Ins ta l l a t i on CD No.3 and run the fo l l owing commands: (Note log in as roo t o r becomeroot by runnin g command su -l )
[admin@ns1 admin]$ su -lPassword:
[root@ns1 root]#mount /mnt/cdrom[root@ns1 root]# cd /mnt/cdrom/RedHat/RPMS[root@ns1 root]# rpm -ivh samba-swat-2.2.3a-6.i386.rpm[root@ns1 root]# cd;umount /mnt/cdrom;eject
Above commands can be expla in ed as fol l ows:
Commands Use for
su -l Become r oo t (admin s t r a t o r ) so t ha t r e s t o f in s t a l l a t i o n conf i g ur a t i o n can be done.
mount /mnt/cd romMoun t the cd rom so tha t we can in s ta l l theswat
cd /mnt/cdrom/RedHat/RPMS
Change cu r ren t work ing d i rec t o r y to RedHat ' s RPMS di rec to ry
rpm -ivh samba-swat-2.2.3a-6.i386.rpm
Us ing rpm too l we can in s t a l l the swa t
cd;umount /mnt/cdrom;eject
Unmount the CDROMand ej ec t the cd.
1.4.1 What i s swat?
Swat i s web admin i s t r a t i o n t oo l f or samba s e rv e r . Usi ng t h i stoo l you can con t ro l /etc/samba/smb.conf f i l e . You don ' t hav e t omanua l l y ed i t t h i s f i l e t o r un samba s er ve r . Swat se rv i c e r unf r om xi ne t d - i n t e r n e t ' s sup er - s er v e r. By de fa u l t on Red Ha t
5
8/4/2019 Samba Server Step by Step
6/44
Linux 7.3 th i s se rv i c e i s tu r n of f fo r secu r i t y re as on s, youneed t o s t a r t t h i s se rv i c e be fo r e us i ng swa t f r om any webbrowser.
1.4.2 How to sta r t swat serv i c e?
Swa t l i s t e n on 901 po r t . Befo re s t a r t in g swa t f rom your windowsweb b rowse r o r f rom Linux s e rve r i t s e l f you have to makechanges in / etc/xinetd.d/swat f i l e as fo l l ow s:
[root@ns1 root]# cd /etc/xinetd.d/[root@ns1 xinetd.d]# vi swat
Look fo r t he en t r y ca l l e d disable and ch ang e i t s va lu e f r om
yes to no . I f you wan t to run the swa t s e rv ic e s f rom remote ly(us ing b rowser ) then s e t (pu t) the IP add re s s o f you r mach ine inf ron t of only_from a t t r i bu te . Fo r e.g. i f you wan t to use swa tserv i ce s fr om Windows 98 machine having IP addres s 192.168.1.2t he n you r en t r y shou l d l oo k l i k e only_f rom = 192.168.1.2127.0.0.1
At th e end you f i l e shou l d l oo k l i k e as f o l l ow s:
service swat
{
port = 901
socket_type = stream
wait = no
only_from = 192.168.1.2 127.0.0.1
user = root
server = /usr/sbin/swat
log_on_failure += USERID
disable = no
}
Save t h e above f i l e and r e s t a r t t he x in e t d daemon and s t a r tt he h t t pd daemon (i f i t s no t r unn i n g) a s f o l l o w s:
[root@ns1 xinetd.d]# /etc/rc.d/init.d/xinetd restartStopping xinetd:[ OK ]
Starting xinetd:
[ OK ]
[root@ns1 xinetd.d]# /etc/rc.d/init.d/httpd startStarting httpd:
[ OK ]
6
8/4/2019 Samba Server Step by Step
7/44
How to st ar t swat from Windows Basedbrowser?
Open the Web browser fr om windows cl i en t machine and type URLas h t tp :// ip- add re s s - o f- l inux- serve r :901, so i f you r IP Addre s s o f Linux serv er is 192.168.1.1 th en URL becomes http://192.168.1.1:901. Also make sure you run the above url from the same windowsmachine whose IP Address i s pu t in only_from at t r i bu t e in /etc/xinetd.d/swat f i l e
How to sta r t swat from Linux Basedbrowser?
To open swat on Linux Servers b rowser i t se l f , then type URL ashttp:// localhost:901/ or http://127.0.0.1:901/ in Nets cape o rkonqu er o r br owse r . I p re f e r r e d t o us e L inux se r ve r so t he r e s to f t he image s i n t h i s t u to r i a l s a re a l so t ak en f r om t he same.
You wi l l ask for user name and password, type roo t as usernameand pas swo rd f or r oo t . P le a se no t t ha t i f you gi ve o th e r us ername & pas sword you wi l l ab le to s ee the con f igu ra t i on bu t canno t make any changes un t i l and unle s s you a re supe r use r -root .
7
8/4/2019 Samba Server Step by Step
8/44
F ig.2: swa t - Auth en t i c a t e you be fo r e s t a r t i n g con f i g u r a t i o n o f samba server
Once you au then t ic a t e you rse l f then you wi l l ge t home page o f swa t a s fo l lows:
8
8/4/2019 Samba Server Step by Step
9/44
Fig.3: swat - Home Page and Adminis t r a t i o n Options (Top of thePage)
Af te r succes s fu l l y open ing the swa t home page, you can con t ro lmos t o f t h e samba s er v e r us i ng t he op t i o n l oc a t e d t op of t hehome page (Home, Global s et c)
9
8/4/2019 Samba Server Step by Step
10/44
Fig.4: swat - Options Toolbar (Buttons)
Swat Toolb arIcons/Buttons
Use for
HOMEThis Icon/Bu t ton wi l l l e t you open swa t homepage.
GLOBALS Use to se t globa l s sec t io n of smb.conf.
SHARESUse t o de f i n e sha r e s f or s er v e r l i k e CDROMdr i v e conn ec t e d t o s er v e r or no rma l d i r e c t o r yon server.
PRINTERS Use th i s opt i on fo r pr in t e r shar i ng.
STATUS
I t shows S er ve r S ta t u s l i k e who i s conn ec t e d
to s amba s e rve r , f i l e opened by use rs e tc. Alsoyou can s ta r t and s top s amba s erve r f rom th i soption.
VIEW I t le t s view you the smb.conf f i l e .
PASSWORDUse th i s opti on for Samba password management(Like new user addit i on, password change etc) .
smb.con f f i l e d iv ided in to s eve ra l s ec t ion , min imum you have toconf i gur e GLOBALS Sec t ion and then res t o f the shares l ik eHOME (Users home dir ec t o ry ), resou rc es shar in g li ke CDROM,Fo ld e r s e t c.
1.4.3 Conf igu r i ng Samba serve r s GLOBALSsect i on (smb.conf)
Globa l s sec t i o n i n you r samba se rv er i s t he f i r s t sec t i o nwhi ch i s us ed con t r o l ove r a l l Samba se r ve r s op t i o n s l i k e nameo f s e rv e r , au t he n t i c a t i o n method e t c.
Next we are going to set samba server s name, workgroup andau t he n t i c a t i o n met hod.
Cl ick on "GLOBALS" i con/bu t t on ( top o f the page) and s e t thef o l l o w in g s amba s e r ve r s g lo ba l op t i o n s wi th g iv en pa rame t e r s .
Options Parameters Remark
10
8/4/2019 Samba Server Step by Step
11/44
workgroup OFFICE
Try to s e t s ameworkgroup name fo ral l c l i en t s , so t ha tth is name can be usedin query.
ne tb i o s name LinuxServe rName of Server (Thisname is shown inNetwork Neighbor hood )
se rv er s t r i n gSamba Print & FileServer
Th is s t r i n g appe a ri n browse l i s t s nex tto the machine namein networkNeighborhood.
Encryp t passwords Yes
For Windows 98 andabove NT 4 wi thServ ice Pack 3 orabove r e qu i r e s t h i s
se t t o be t r ue .
ho st s a l l ow192.168.1.0/255.255.255.0
Use to spec i f i e swhich host s/computer sar e pe rm i t t e d t oaccess a SambaSe rv er s se rv i c e s i. e.sha red re sou rce s . Wewant to re st r i c t th eacces s to LocalNetwork (Inte rna lLAN) and not to theexte rn a l Network
(In t e r n e t ) . P le a se no ttha t he re we a reusi ng 192.168.1.0 CClass Network range.I f you a re u sing A o rB Class make theapprop r i a t e changeshere.
11
8/4/2019 Samba Server Step by Step
12/44
Fig.5: swat - Global s Option Page
12
8/4/2019 Samba Server Step by Step
13/44
Make sure secur i t y (Authent ic a t i on) method is USER leve l .
Fina l l y c l i ck on "Commit Change s " But t on t o f i n i s h t he bas i cconf ig ur a t i on of GLOBALS sect i on of smb.conf (Samba serv er )
1.4.4 Crat ing Samba Password database
Pas swo rd ar e used t o au th en t i c a t e va r i ou s se r v i c e s prov i de d bysamba server. Windows uses i t own method of s to r i ng passwordand L inux use s i t s own method o f s to r i ng password in f i l e s ,fu r the r bo th windows and L inux uses d i f fe ren t methods toencrypt the passwords .
In L inux passwords a re s to red in /etc/passwd (use r in fo rma t ion )or /etc/shadow (passwords) f i l es . You can use the same Linux username which i s s to red in pa ssword f i l e s on Linux Serve r , bu t no tthe password. The password management and au thent i ca t i on isdif f e r en t on both windows and Linux. Hence samba mainta in eds ep a r a t e enc r yp t e d pa sswo rd f i l e : /etc/samba/smbpasswd . You canuse smbpasswd program to change the password of user .
You have to add new user to samba password database so tha t
samba cab au th en t i c a t e t he co r re c t use r aga i ns t any se rv i c e i tp rov i d e t o use r .
1.4.4.1 How to add new use r to Sambapassword databas e?
There a re two methods to add user to samba password da tabase :
Method firs t :
Th is met hod app l i e s t o use r whose ac co un t a l r e a dy pr e se n t onLinux se rver . You can use swat to add user to password da tabasef i l e as fo l l ow s:
13
8/4/2019 Samba Server Step by Step
14/44
To add the admin user to samba password database: (admin userac cou n t i s a l r e a d y p re s en t Linu x s er v e r so n o need t o addadmin user)
Cl ick on "PASSWORD" Icon.
Type User Name: admin
Type the new user password (aga in re type the samepassword)
Cl ick on "Add New User " bu t ton to add admin use r t o
password da tabase f i l e .
Fig.6: swat - Password Option Page
Remember th is admin user password cab be d i f fe re n t (normal lyi t shou ld be d if f e r e n t fo r secu r i t y r ea so ns) f rom th e ourno rma l sys tem 's admin accoun t. Add the re s t o f the users o f
your network by above mentio ned method.
Method Second:
Second me thod invo lves the c rea t ion o f u se r s accoun t on Linuxs er v e r f i r s t , and t he n add i t t o s amba p as swo rd da t ab a s e. Youcan c rea t e new use r us ing redhat- confi g- users user management
14
8/4/2019 Samba Server Step by Step
15/44
tool (You can run thi s tool from KDE - GUI Desktop by cl ic k in gon kontr o l- panel > User Manager) or use command l ine programuseradd. (For e.g. # useradd rani ). Then add the user to passwordda tabase us ing swat as ment ioned above or use "smbpasswd -a"sambas u t i l i t y a s shown be low.
To add new user le t s say raju f rom she l l promp t i t se l f and no tusing swat then use fol lowi ng two command:
#useradd raju
# smbpasswd -a rajuNew SMB password: rajus password
Retype new SMB password: rajus password
Added user raju.
Password changed for user raju.
Above commands can be expla in ed as fol l ows:Commands Use for
useradd rajuAdd new user ra j u to Linux Password databasef i l e .
smbpasswd -a rajuAdd the user ra ju to Samba password da tabasef i l e (i nd i c a t e d by -a op t i o n) and s e t t he newpassword.
1.4.5 Crati ng shared resource s
Sha r ing fo lde r us ing windows 95/98 i s ve ry easy, ju s t r igh tc l i ck on fo l de r , se l ec t t he sharing op t ion , spec i fy sha re nameand password, c l i ck on "Ok" to sha re the fo lde r . S imi la r ly youcan sha r e f ol d e r s on Linux se rv e r so t ha t use r can s to r e /s ha r ef i l e s ea si l y . Here we wi l l sha r e Linux s er ve r d i re c t o r y ca l l e d/home/public, th i s di r ec t o r y (fo ld e r) i s used b y a l l use r tos to re commonly used f i l e s . Fo r th i s pu rpose we need to u se"SHARE" opti on of swat.
(a) Click on "SHARE" icon.(b) Type public in f ro n t of cr ea t e sha re t ex t box and c l i ck on
"Create Share " button.(c) For comment set parameter as - Publ ic Directory(d) Fo r pa th s e t pa rame te r a s - /home/publ i c(e) Se t gues t ok to - Yes( f ) Cl ick on "Commit Change s " Button.
15
8/4/2019 Samba Server Step by Step
16/44
Fig.7: swat - How to add new share (How to share fol de r)
(g) Open your te rmina l window and t ype fol low ing two commandsa t sh el l pr omp t:
# mkdir /home/publ i c# chmod 0777 /home/publ i c# chmod o+t /home/publ i c
Above commands can be expla in ed as fol l ows:
Commands Use for
mkdir /home/publicCrea t e d ir e c t o r y /home/publ i c so tha t a l l of use r put the sha red f i l e s in th i s fo ld er s
chmod 0777 /
home/public Make the d i rec to ry wor ld readab le .
chmod o+t /home/public
Se t t he s t i c ky bi t on pub l i c l y sh ar e d f o ld e rso t ha t th e owner of t he f i l e can d el e t e t hef i l e . Gener a l l y i f a use r has wri t epe rmi s s i o n t o a di r e c t o r y t he n use r cande le t e any f i l e f r om th e d ir e c t o r y . Not etha t se t s t i c ky bi t on ly fo r publ i c l y sha redfo lde rs .
Use share op t ion to share CD-ROMdrive , F loppy dr ive , Par t i t i on(Linux/DOS/Windows/NFS) etc.
1.4.5.1 Sharin g Serve r s CDROMDrive
(a) Click on "SHARE" icon.(b) Type cdrom i n f ro nt of cr ea t e sha re t ex t box and c l i ck on"Create Share " button.(c) For comment set paramet e r as - Linux Server s CD-Rom Drive(d) Fo r pa th s e t pa rame te r a s - /mnt/cdrom(e) Se t gues t ok to - Yes( f ) Cl ick on "Commit Change s " Button.
16
8/4/2019 Samba Server Step by Step
17/44
Fig.8: swat - Shar in g CDROMDriv e
Note tha t you can mount the CDROMdrive as user c l i cks on th issha re f rom any windows c l i en t . Th is wi l l he lp u se rs , becausewithout mount ing CDROMyou can ' t use i t and every t ime roo tus er migh t be n ot ava i l a b l e .
(a) Click on "Advance vi ew " butt on for CDROMshare, then scrol ldown to Miscel l aneous Options
(b) Set root preexec to mount /mnt/cd rom(c) Set root pos texec to umount /mnt/cdrom(d) Clic k on "Commit Change s " Button.
Fig.9: swat - Automati ca l l y mounting & unmounti ng of f i l e s .
1.4.6 Star t i n g smbd & nmbd demons
Af te r mak in g abov e s et t i n g , now i t s t i me t o s t a r t samba s e r ve r .You can do th is f rom swat as fo l lows :
Cick on "STATUS" option.
Cl ick on Start smbd and Start nmbd bu t t on t o s t a r t sambadaemons.
17
8/4/2019 Samba Server Step by Step
18/44
Or manu l ly you can s ta r t the s amba s e rve r by runn ingcommand:
# /e tc / rc .d / in i t .d /smb s ta r t
1.4.7 Samba serv er in Acti on
From Windows machine logi n using your username & password.Open the Network Neighbo rhood on windows cl ie n t , you shouldsee LinuxServer . Double c l i ck on i t ( I t may ask you password),g iv e t he cu r re n t l y l og i n use r s pas swo rd (t hi s pa sswo rd i sente r by you at PASSWORDS opti on of the swat), you can now seeuse rs home d i rec t o r y a s we l l a s Pub l ic d i rec t o r y and CDROM.
Fig.10: Network Neighborhood aft er se t t i ng Samba showing Wks(windows 98) & LinuxServer
18
8/4/2019 Samba Server Step by Step
19/44
Fig.11: Network Neighborhood Showing LinuxServe r ' s sharedf o l d e r s / r e s o u r c e s .
1.5 Sharing Print er
Pr i n t e r sha r i n g i s ano th e r impo r t an t f ea t u r e of any ne two rk.
You can sh ar e p r in t e r conne c t e d t o Li nux s er v e r o r p r i n t e rconnect ed to windows computer with Linux.Nex t pa r t o f t h e t u t o r i a l wi l l show you how t o ach i e v e t h i s .
You can share the pr in t e r two ways:
19
8/4/2019 Samba Server Step by Step
20/44
1) Your pr in t e r i s connec ted to another Windows Machine - youcan sha r e t h i s us i ng s amba and wan t t o p r in t f r om Linu x i t s e l f .
2) Your pr i n t e r i s conne ct e d t o Linux Ser ve r i t s e l f and a l l
windows c l i en t s wan ts to use i t .
Red Hat Linux 7.3 provides the graphica l X windows too l -pr in t co nf ut i l i t y . This ut i l i t y wri te s i t s conf ig ur a t i o n to / e tc/p r i n t c a p f i l e and manages t he f i l t e r s and s poo l i ng fo ryou r p r in t e r .
printconf too l cab be s t a r t as fo l l ow s:
From KDE Desktop > Click on Contro l- panel > Click on Print e rConfigur a t i on, which wil l open windows as shown in Fig. 21 .Once you s t a r t e d t o add t he pr i n t e r i t wi l l gi ve you cho i ce show the sys tem wil l communica te wi th the pr in t e r (as shown inFig.17 )
Queue Type Use for
LocalP r i n t e r(LOCAL)
Thi s kind of pr i n t e r ( s) di r ec t l y a t t ac he d to t heone o f t he po rt of Linux Ser ve r i t s e l f .
Unix Pr in te r(LPD)
Thi s k ind of pr i n t e r a t t a ch e d t o ano th e r r emot e
Unix/Linux computer sys tem and can be access overTCP/IP network.
WindowsPrint e r (SMB)
Th is k in d o f pr i n t e r a t t a c h e d sy s t em whi ch work on SMB network (lik e Microsof t Windows)
NovellPrint e r (NCP)
Th is k in d o f pr i n t e r a t t a c h e d Nove l l Netwo rk
J e tDi rec tP r i n t e r(JETDIRECT)
Thi s kind of pr i n t e r di r ec t l y connec t ed tone two rk i. e. Networ k p r in t e r , t h i s k in d of pr i n t e rhave ded ica t ed IP add re s s .
Af te r se l e c t i n g t he Queue t yp e you need t o sp ec i f y t he p r in t e r
d r ive r .
1.5.1 Printer i s connected to AnotherWindows System
20
8/4/2019 Samba Server Step by Step
21/44
In my network I use EPSON 670 Color Print er which is connect edto Windows ME based Sys tem. I a ssume tha t p r in te r d r ive rs a reins t a l l e d . Fi rs t s t ep i s to shar e the pr in t e r as fo l lows onWindows ME based sys t em:
Sta r t Windows based sys t em and log in to i t . Then
1) Goto S ta r t > Se t t i n g s > Pr i n t e r s
Fig.12: Shari ng Windows Prin t e r
2) Se lec t the pr in t e r (EPSON 670) > Right Cl ick i t > Se lec tSharing
21
8/4/2019 Samba Server Step by Step
22/44
Fig .13: Shar ing Pr in te r in Windows
3) I n t h e Pr i n t e r Prop er t i e s d ia l o g box Cl i c k on > Sha r ed Asrad io bu t ton > Ente r Share Name "EPSON" > Set Comment as "Epson670 Pr i n t e r " > I f you wan t t he pas swo rd pr ot e c t e d p r in t e r t he nGive Password > Click on "OK" button.
22
8/4/2019 Samba Server Step by Step
23/44
Fig.14: Pr in te r shared as EPSON
Cl ick on "Ok" Button. Now your prin te r connect ed to windowsmach ine i s sha red and ava i l ab le to o the r windows mach ine a swell as for Linux machine us ing samba cl i en t . You can now useany windows machine to connec t the pr in t e r , download the
d r ive r f rom tha t mach ine and p r in t i t . Even you can use L inuxSer ve r o r Works t a t i o n t o p r in t on t h i s r emo t e windows p r i n t e r .For thi s purpose you need to use Samba i .e. Sambas Clien tp rog r am to conne c t t o t h i s pr i n t e r and p ri n t i t . But be fo r et ha t you need t o add t h i s pr i n t e r t o you r Linux works t a t i o n so r s e rv e r as fo l l o ws:
1) Login to Linux serve r. Star t the X Windows (KDE) and thenOpen Con t ro l - pane l > Cl ick on P r in te r Conf igu ra t i on , which wi l lopen windows as fol l ows:
23
8/4/2019 Samba Server Step by Step
24/44
Fig.15: p r i n t c on f Ut i l i t i e s main sc r ee n
2) Cl ick on New but ton to to add new pr in t e r ( i. e. p r in t queue)
24
8/4/2019 Samba Server Step by Step
25/44
Fig.16: Adding new smb prin t e r with wizards
3) Set the queue name to WIN_EPSON > Selec t Queue type asWindows Printer > Click on Next bu t t o n t o con t i n u e .
25
8/4/2019 Samba Server Step by Step
26/44
Fig.17: Prin te r Queue name and type as Windows Pri nt e r (SMB)
4) Se t t he op t i o n s as f o l l o ws:
OptionSe t t o
Value/Attribute
Remark
Share \ \wks \EPSONSpecif y the Windows Pr in te r Sharename as \ \ computer name\ sha re- name
Host I P 192.168.1.3IP Address of machine where pr in t e ris connec te d .
Workgroup OFFICE Workgroup name
User --Se t the username, in our case we havenot any username whi le shar i ngp r i n t e r .
Password --Se t the password, in our case we havenot any username whi le shar i ngp r i n t e r .
-- Ind ica te s none.
Cl ick on next bu t t o n t o con t i n u e.
26
8/4/2019 Samba Server Step by Step
27/44
Fig.18: Configur in g remote windows prin te r
5) Se le c t t he pr i n t e r dr i ve r as Pos t sc r i p t Pr in t e r and Cl ic k on Next bu t t o n t o con t i n u e .
27
8/4/2019 Samba Server Step by Step
28/44
Fig.19: Se le c t i n g pr i n t dr i v e r f or remo te pr i n t e r .
Caution: Don' t se le c t her e pr in t e r dr iv er , in s ta t e d se le c t asfo l lows :
PrinterDriver
Why Example
Pos t s c r iptP r i n t e r
Se le c t t hi s i f you have co lo rDeskJ e t, Pos t s c r i p t pr i n t e r .
Mos t ly a l l DeskJe t ,Pos t sc r i p t Pr i nt e r sl i ke EPSON 670 or HPDJ-840
TextOnlyP r i n t e r
Se le ct th i s i f remot e pr in t e ron ly suppo r t s t ex t l i k e DotMat r i x pr i n t e r
Dot Matr ix Pr in te rl i k e EPSON or TVSE orWIPRO
Raw
Prin tQueue
Se le c t th i s fo r ne two rk
pr i n t e r or i f bot h of abovedon ' t works . Network prin t e r
When you a re p r in t in g on remote p r in te r you do as fo l lows:
Your- Document/Image -> Remote Prin t e r Driver > Remote Prin t e r
28
8/4/2019 Samba Server Step by Step
29/44
And not as fo l l ows: (which is no t correc t )
Your- Document/ Image -> Local Pr inter Dr iver -> Remote Pri n t e rDriver > Remote Print e r
So whenever you prin t on any of the remote prin t e r (SMB, LPD,NPC e t c) us e t he above t h r e e as p r in t e r d r i ve r .
6) Fina l l y c l i ck on fi n i s h bu tt on to f i n i s h th e con f ig u ra t i o nand add t h i s pr i n t e r t o Li nux Se rv e r/Work s t a t i o n .
Fi g.20: F in i s h i n g t he smb pr i n t e r con f i g u r a t i o n
Now save your changes as: F i le > Save Changes and res t a r t thel pd so t ha t new p r in t e r can be u se d.
Use lp r command to pr in t f rom Linux se rver to smb pr in t e r .
# lp r memo1.txt
29
8/4/2019 Samba Server Step by Step
30/44
In ca se you have more p r in te r then you can run fo l lowingcommand: (remember th is pri n t e r queue name is win_epson, Seethe Fig.17 )
# lpr -Pwin_epson memo1.txt
To se e s t a t u s o f d ef au l t pr i n t e r g iv e command:
# lpq
To se e s t a t u s o f a l l p r in t e r g iv e command:
# lpq -a
To remove a l l p r in t job f rom queue ( i. e. s top p r in t in g ) g ivecommand:
# lprm -a
To remove job no. 15 f rom pri n t e r win_epson give command:
# lprm -Pwin_epson 15
1.5.1 Printer i s connected to Linux Serveri t s e l f .
P le a se no te t ha t I am show in g y ou s ame pr i n t e r f or t h i s pa r to f t u t o r i a l . ( i.e. Epson 6 70 P ri n t e r ) , so don ' t ge t puz zl e d he re .
Login to Linux serve r . Star t the X Windows (KDE) and then Openkon t r o l - pane l > Cl i c k on Pr i n t e r Conf i g u r a t i o n , whi ch wi l l openwindows as fol l ows:
30
8/4/2019 Samba Server Step by Step
31/44
Fi g.21: In s t a l l i n g Loca l Pr i n t e r
Cl ick on "New" Bu t ton to add new p r in te r ( i. e p r in t queue)
Fig.22: Cli ck on New butt on
31
8/4/2019 Samba Server Step by Step
32/44
Add new p r in te r (Pr in t Queue Wiza rd S ta r t s ) and c l i ck on "Next "button.
F ig .23: S ta r i ng Wizard to add the new pr in t e r
Type t he Queue name as "EPSON" and s e l ec t pr i n t e r queue t yp e as"Local Prin te r (LOCAL)" and c l ic k on "Next " button.
32
8/4/2019 Samba Server Step by Step
33/44
Fig.24: Set Queue name & typ e
pr in t c on f wil l t ry to det ec t your pr in t e r au toma t ic a l l y , i f i t s de t ec t e d i t wi l l show t he f ol l o wi n g window > Cl i ck Next to
cont inue .
33
8/4/2019 Samba Server Step by Step
34/44
Fig.25: Pr i n t e r i s au toma t i c a l l y de te c t e d by pr i n t c o n f
pr in t c on f wil l a ls o se le c t s dr iv er fo r you, i f i t ' s not cor r ec tse l e c t t he one a cco r d i ng t o you r pr i n t e r > Cl i ck Next but ton
to con t inue .
34
8/4/2019 Samba Server Step by Step
35/44
Fig.26: I ns t a l l i n g Pr in t e r dr i ve r
Fina l l y pr in t e r i s ins t a l l e d , c l i ck on Finish bu t t on t o cr ea t et he en t ry i n /et c/p r i n t c a p f i l e .
35
8/4/2019 Samba Server Step by Step
36/44
Fig.27:
Note: I f you r pr i n t e r i s no t de te c t e d you need t o spec i f y t hecustom device.
Now cli ck on File > Save Changes . I f you dir ec t l y give commandFi le > Qui t , Fo l lowing d ia log box wi l l appea r on sc reen: (Cl ick on "Yes " bu t ton to save changes)
Fig.28: Selec t yes to save changes
Fina l l y you wi l l ge t fo l l o wi n g sc r ee n i. e. l p d r e s t a r tsucceeded.
36
8/4/2019 Samba Server Step by Step
37/44
Fi g.29: Your l pd r es t a r t e d and n ew p r in t e r i s r ea dy t o us e.
Aft er se t t i n g th e pr i n t e r wi th Linux, ju s t r es t a r t th e smb byrunn ing fo l lowing command, th i s ensu re s tha t L inux p r in te rge t s ready fo r s amba.
# /e tc / rc .d / in i t .d /smb res ta r t
Once re s t a r t ed now you can b rowse the p r in te r in Network Neighborhood as shown in fo l l owing f igur e :
Fig.30: New pri n t e r shown f rom Network Neighborhood or MyNetwork Place
Bu t be fo re u sing th i s p r in te r f rom any windows based ne twork you need t o connec t th i s pr i n t e r (in st a l l th e dr i ve r - c li e n ts ide) a s fo l l ows :
Open Network Neighbor hood f rom window machin e:
Righ t Cl ick on p r in te r (Epson) > Cl ick on "Open" or "Connect "menu.
37
8/4/2019 Samba Server Step by Step
38/44
Fi g.31: In s t a l l i n g Cl i e n t Si de Dr iv e r
Th is wi l l s t a r t Add Pr i n t e r Wiza rd > Cl i c k on "Next " bu t t on tocont inue .
Fig.32: Wizar d s ta r t s t o i ns t a l l t he pr i n t e r
Sel ec t "Network Printer " so t ha t we can pr i n t on pr i n t e rconnec ted to L inux Serve r > Cl ick on "Next " bu t ton to con t inue .
38
8/4/2019 Samba Server Step by Step
39/44
Fig .33: You l ik e to se t Network pr in t e r
Cl ick on "Browse " bu t ton to g ive Linux se rver Queue or you cantype as \ \L inuxse rve r- name\queue name.
Fig.34: Spec ify the Network pa th of p r in t e r
Click on Workgroup name (in our case it s OFFICE) > Then Clickon Linuxse rve r > And f ina l ly on sha red p r in te r name > F ina l l yc l i c k on "OK" button.
39
8/4/2019 Samba Server Step by Step
40/44
F ig.36: Spe ci f y i n g t he ne two rk pa t h fo r p r in t e r us i ng br owsebut ton
Now cl i ck on "Next " bu t ton to con t inue .
Fig.37: Network path is given
At th i s s t age Wiza rd wi l l a sk the d r ive r fo r Windows EPSON 670(Cl ien t s ide) you need to g ive th i s d r ive r f rom Floppy/CD o r i f i t s s t o r e d somewhe re i n t he ha rd d r iv e. Cl i ck on "Have Disk..."button.
40
8/4/2019 Samba Server Step by Step
41/44
Fi g.38: In s t a l l i n g t he d r iv e r f or windows
Se le c t t he app ro pr i a t e p la c e and t y pe t he pa t h i n box. (wher eyour pr i n t e r s dr i ve r ar e s to r ed)
Fi g.39: Spec i f y i n g t he l oc a t i o n of dr i v e r
Wiza rd wi l l au toma t ic a l ly de tec t and shows you pr in t e r name,j us t c l i ck on "Next " bu t ton to con t inue .
41
8/4/2019 Samba Server Step by Step
42/44
Fig.40: Windows wi l l show the ava i l ab le p r in te r d r ive r ( s )
Type the p r in te r name and c l i ck on "Finish " bu t t o n t o f i n i s ht he con f i g u r a t i o n .
Fig.41: Give name to prin t e r
Windows wi l l copy t he p r in t e r f i l e s .
42
8/4/2019 Samba Server Step by Step
43/44
Fig.42: Windows copying the f i l e s
And f i n a l l y shows t h e d ia l o g, con f i r m s t ha t se t u p i s compl e t e ds u c c e s s f u l l y .
Fig.43:
Now you can p r in t f rom any app l i ca t i on to th i s smb p r in te r .
Af te r abov e con f i g u r a t i o n you wan t t o s t a r t t he Samba se r v e rau t oma t i c a l l y wi th ea ch and eve r y t i me sy s t em ge t s r eb oo t s ,run the fo l l owing command for th is purpose .
# chkconf ig --level 35 smb on
1.6 Resources
(1) Man Pages:(a) man smb.conf : Al l the conf igu ra t i on op t ion s for samba.(b) man lpq: Al l the op t ion s re la t ed to lpq command.(c) man lprm: All the opti ons re l a t ed to lprm command.(d) man lpd: Informat io n on l in e pr in t e r daemon.(e) man lpc: Line Print e r cont ro l program man page.
43
8/4/2019 Samba Server Step by Step
44/44
(2) Swat Document a t i on :Swa ts f i l e s main page con ta in s :
Documentation
Book - Using Samba - wri t t en by Rober t Eckst e in , DavidCol l i e r - Brown and Pe te r Kel ly
Samba HOWTOCol l ec t i o n
Othe r ut i l i t i e s in fo rma t i on.