SAMBA IN SOLARIS
What we are going to learn about SAMBA,
·
Packages & services
·
Where the files are stored
·
Configuring samba
·
Add users for samba
·
How to check who is logged in
via samba
·
How to kill samba user
·
How to check samba version
So, what is this samba?
Somehow related to Gabbar Singh?
Nope…
It has nothing to do with Gabbar Singh, it is a protocol
developed by Microsoft widely used for sharing & print services.
It is termed as SMB
(server message block) which allows File System sharing with heterogeneous
environment with full access.
What is this Heterogeneous Environment?
Sharing an FS in Solaris and accessing the same via
windows, Linux, mac….
DAEMONS
There are 2 daemons for SMB
smbd
nmbd
PORT
Works on ports 137 & 139
PACKAGES
& SERVICES
root@sol-test-1:>/# pkginfo -x | grep -i
samba
SUNWsmbac samba - A Windows
SMB/CIFS fileserver for UNIX (client)
SUNWsmbar samba - A Windows SMB/CIFS
fileserver for UNIX (Root)
SUNWsmbau samba - A Windows
SMB/CIFS fileserver for UNIX (Usr)
root@sol-test-1:>/# svcs -a | grep -i
samba
disabled
16:23:49 svc:/network/samba:default
root@sol-test-1:>/# svcadm enable samba
root@sol-test-1:>/# svcs -a | grep -i
samba
offline*
0:46:51 svc:/network/samba:default
root@sol-test-1:>/# tail
/var/adm/messages
Dec 28 00:46:53 sol-test-1 svc.startd[8]: [ID 652011
daemon.warning] svc:/network/samba:default: Method "/usr/sbin/smbd
-D" failed with exit status 1.
Dec 28 00:46:54 sol-test-1 last message repeated 2 times
Dec 28 00:46:54 sol-test-1 svc.startd[8]: [ID 748625
daemon.error] network/samba:default failed: transitioned to maintenance (see
'svcs -xv' for details)
Well, it refuses to start, let’s see what is in svcs –xv
root@sol-test-1:>/# svcs –xv
svc:/network/samba:default (SMB file server)
State: maintenance
since Sun Dec 28 00:46:54 2014
Reason: Start method failed repeatedly, last exited with
status 1.
See:
http://sun.com/msg/SMF-8000-KS
See: man -M
/usr/share/man -s 1m smbd
See: man -M
/usr/share/man -s 4 smb.conf
See:
/var/svc/log/network-samba:default.log
Impact: This service is not running.
No need to worry, it’s all b’coz still we did not
configured samba on system.
root@sol-test-1:>/# ps -elf |grep -i smb
0 S root
5114 5027 0 92
20 ? 360
? 00:47:11 pts/4 0:00 grep
-i smb
WHERE
THE FILES ARE STORED
root@sol-test-1:>/# cd /etc/samba/
root@sol-test-1:>/etc/samba# ls -l
total 22
dr-x------ 2
root bin 512 Apr 25 2014 private
-r--r--r-- 1
root bin 9662 May 12 2011smb.conf-example
smb.conf-example is the main conf file for samba,
CONFIGURING
SAMBA
We need to copy it with just only smb.conf
root@sol-test-1:>/# cp
/etc/samba/smb.conf-example /etc/samba/smb.conf
root@sol-test-1:>/etc/samba# ls -l
total 42
dr-x------ 2
root bin 512 Apr 25 2014 private
-r--r--r-- 1
root root 9662 Dec 28 02:26 smb.conf
-r--r--r-- 1
root bin 9662 May 12 2011smb.conf-example
Have u seen the Perms on smb.conf?
No Prob, either change the Perms or use wq! For forceful
write while using vi
root@sol-test-1:>/# mkdir /samba-shared
Now,
root@sol-test-1:>/#
vi/etc/samba/smb.conf
Scroll down to last, there u find sample setting.
Just do same beneath that, like
[shared-dir]
comment = my samba shared dir
path = /samba-shared
valid users = anurag test1
public = no
writable = yes
printable = no
create mask = 0765
So what I did above?
path= complete path of what i want to share
valid users= which users allowed to access samba share
public= does this for everybody?
writable=does the users can create under this share?
create mask=what would be default mask for created files
under this share
Now disable & enable samba,
root@sol-test-1:>/# svcadm disable samba
root@sol-test-1:>/# svcs -a |grep samba
disabled
4:19:02 svc:/network/samba:default
root@sol-test-1:>/# svcadm enable samba
root@sol-test-1:>/# svcs -a |grep samba
online
4:19:10 svc:/network/samba:default
Service is online, daemons are running
root@sol-test-1:>/# ps -ef |grep -i smbd
root 5371 5027
0 04:22:01 pts/4 0:00 grep
-i smbd
root 5359 5356
0 04:19:12 ? 0:00
/usr/sbin/smbd -D
root 5356 1
0 04:19:11 ? 0:00
/usr/sbin/smbd–D
Can we use samba now?
Perhaps still not, b’coz samba needs his user and his
passwords also, though password on /etc/passwd and samba password should be
same,
We already list users for samba, but did not defined
password for them
PASSWORD
FOR SAMBA USERS
root@sol-test-1:>/# smbpasswd -aanurag
New SMB password:
Retype new SMB password:
Added user anurag.
root@sol-test-1:>/# smbpasswd -a test1
New SMB password:
Retype new SMB password:
Added user test1.
PASSWD
LOCATION OF SAMBA USERS
/etc/samba/private
root@sol-test-1:>/# cd /etc/samba/private
root@sol-test-1:>/etc/samba/private# cat smbpasswd
anurag:100:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:AA647B916A1FAD374DF9C30711D58A7A:[U ]:LCT-549F38CB:
test1:103:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:AA647B916A1FAD374DF9C30711D58A7A:[U ]:LCT-549F3C14:
Now let’s check what we did,
But before that one more interesting thing samba provides
us, to check the config file
TESTING
SAMBA CONFIGURATION
root@sol-test-1:>/# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (256) to minimum
Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[shared-dir]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
Now I went to run prompt of windows then,
not working,
ADD
USERS FOR SAMBA
I need to add these users, for samba access on Local
system
root@sol-test-1:>/# /usr/bin/smbclient
-U anurag -L localhost
Enter anurag's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.8]
Sharename
Type Comment
--------- ---- -------
shared-dir
Disk my samba shared dir
IPC$ IPC IPC Service (Samba Server)
anurag
Disk Home Directories
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.8]
Server Comment
--------- -------
Workgroup Master
--------- -------
root@sol-test-1:>/# smbclient -U test1 -L
localhost
Enter test1's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.8]
Sharename
Type Comment
--------- ---- -------
shared-dir
Disk my samba shared dir
IPC$ IPC IPC Service (Samba Server)
test1
Disk Home Directories
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.8]
Server Comment
--------- -------
Workgroup Master
--------- -------
Now I tried this from windows run prompt
And I got the shared dir as well as anurag’s home dir
also
HOW TO
CHECK WHO IS LOGGED IN VIA SAMBA
root@sol-test-1:>/# smbstatus
Samba version 3.5.8
PID
Username Group Machine
-------------------------------------------------------------------
6353
anurag other hp-pc (192.168.234.1)
Service
pid machine Connected at
-------------------------------------------------------
shared-dir
6353 hp-pc Sun Dec 28 05:26:22 2014
anurag
6353 hp-pc Sun Dec 28 05:26:22 2014
IPC$
6353 hp-pc Sun Dec 28 05:24:42 2014
No locked files
NOW I
WANT TO KILL THAT SAMBA USER,
root@sol-test-1:>/# who
root
console Dec 28 05:21 (:0)
rootpts/2
Dec 27 23:39 (192.168.234.1)
rootpts/4
Dec 27 23:39 (192.168.234.1)
root@sol-test-1:>/# last |head
root
console :0 Sun Dec 28 05:21 still logged in
rootpts/2
192.168.234.1 Sat Dec 27
23:39 still logged in
rootpts/4
192.168.234.1 Sat Dec 27
23:39 still logged in
rootpts/3
192.168.234.1 Sat Dec 27 22:31
- 00:31 (02:00)
root@sol-test-1:>/# cat /var/log/authlog
|tail -3
Dec 27 22:31:37 sol-test-1 login: [ID 254462 auth.notice]
ROOT LOGIN /dev/pts/3 FROM 192.168.234.1
Dec 27 23:39:30 sol-test-1 login: [ID 254462 auth.notice]
ROOT LOGIN /dev/pts/4 FROM 192.168.234.1
Dec 27 23:39:31 sol-test-1 login: [ID 254462 auth.notice]
ROOT LOGIN /dev/pts/2 FROM 192.168.234.1
So… there is no proper info about any user anurag logged
in via samba,
Well, samba has this info
root@sol-test-1:>/# smbstatus
Samba version 3.5.8
PID
Username Group Machine
-------------------------------------------------------------------
6353
anurag other hp-pc (192.168.234.1)
Service
pid machine Connected at
-------------------------------------------------------
IPC$
6353 hp-pc Sun Dec 28 05:24:42 2014
No locked files
root@sol-test-1:>/# pkill 6353
root@sol-test-1:>/# smbstatus
Samba version 3.5.8
PID
Username Group Machine
-------------------------------------------------------------------
6353
anurag other hp-pc (192.168.234.1)
Service
pid machine Connected at
-------------------------------------------------------
IPC$
6353 hp-pc Sun Dec 28 05:24:42 2014
No locked files
HOW TO
CHECK SAMBA VERSION
root@sol-test-1:>/# smbd -V
Version 3.5.8
No comments:
Post a Comment