LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   smbclient is not found (https://www.linuxquestions.org/questions/linux-networking-3/smbclient-is-not-found-4175455347/)

sasaditya 03-24-2013 04:54 AM

smbclient is not found
 
Hello linuxquestion.org,i am new to this linux operating system.i had configured my samba standalone by the following manner from starting to end..

[root@server ~]#hostname server
[root@server ~]#vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=server
NETWORKING_IPV4=yes
GATEWAY=192.168.0.30

[root@server ~]#ifconfig eth0 192.168.0.30 netmask 255.255.255.0 broadcast 192.168.0.255
[root@server ~]#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
USERCTL=no
ONBOOT=yes
BOOTPROTO=none
BROADCAST=192.168.0.255
NETWORK=192.168.0.0
NETMASK=255.255.255.0
IPADDR=192.168.0.30
IPV4INIT=yes
IPV6INIT=no

[root@server ~]#cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.0.30 server

[root@server ~]#service network restart
[root@server ~]#yum install samba* -y
root@server ~]#groupadd smbgrp
[root@server ~]#useradd tom
[root@server ~]#passwd tom
[root@server ~]#mkdir /share
[root@server ~]#mkdir /share/smb
[root@server ~]#chmod 777 /share
[root@server ~]#chmod 777 /share/smb
[root@server ~]#chown –R root:smbgrp /share/smb
[root@server ~]#touch share.txt
[root@server ~]#vi /etc/samba/smb.conf
#======================= Global Settings=============================

[global]

workgroup = WORKGROUP
server string = Samba Server Version %v
netbios name = HOSTNAME
lanman auth = yes
client lanman auth = yes
directory mask = 0777
force directory mode = 0777
directory security mask = 0777
force directory mode = 0777
create mask = 0777
force create mode = 0777
security mask = 0777
force security mode = 0777
interfaces = lo eth0 192.168.0.30/24
hosts allow = 127. 192.168.0.

# --------------------------- Logging Options -----------------------------
#
# Log File let you specify where to put logs and how to split them up.
#
# Max Log Size let you specify the max size log files should reach

# logs split per machine
log file = /var/log/samba/log.%m
# max 50KB per log file, then rotate
max log size = 50

# ----------------------- Standalone Server Options ------------------------
#
# Scurity can be set to user, share(deprecated) or server(deprecated)
#
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.

security = share
passdb backend = tdbsam


# ----------------------- Domain Members Options ---------------------

; security = domain
; passdb backend = tdbsam
; realm = MY_REALM

; password server = <NT-Server-Name>

# ----------------------- Domain Controller Options ------------------ security = user
passdb backend = tdbsam

; domain master = yes
; domain logons = yes

# the login script name depends on the machine name
; logon script = %m.bat
# the login script name depends on the unix user used
; logon script = %u.bat
; logon path = \\%L\Profiles\%u
# disables profiles support by specifing an empty path
; logon path =

; add user script = /usr/sbin/useradd "%u" -n -g users
; add group script = /usr/sbin/groupadd "%g"
; add machine script = /usr/sbin/useradd -n -c "Workstation (%u)" -M -d /nohome -s /bin/false "%u"
; delete user script = /usr/sbin/userdel "%u"
; delete user from group script = /usr/sbin/userdel "%u" "%g"
; delete group script = /usr/sbin/groupdel "%g"


# ----------------------- Browser Control Options ----------------------------
#
# set local master to no if you don't want Samba to become a master
# browser on your network. Otherwise the normal election rules apply
#
# OS Level determines the precedence of this server in master browser
# elections. The default value should be reasonable
#
# Preferred Master causes Samba to force a local browser election on startup
# and gives it a slightly higher chance of winning the election
; local master = no
; os level = 33
; preferred master = yes

#----------------------------- Name Resolution -----------------------

; wins support = yes
; wins server = w.x.y.z
; wins proxy = yes

; dns proxy = yes

# --------------------------- Printing Options -----------------------------
# You can choose a non default printing system using the Printing option

load printers = yes
cups options = raw

; printcap name = /etc/printcap
#obtain list of printers automatically on SystemV
; printcap name = lpstat
; printing = cups

# --------------------------- Filesystem Options ---------------------------
; map archive = no
; map hidden = no
; map read only = no
; map system = no
; store dos attributes = yes


#============================ Share Definitions=======================

[homes]
comment = Home Directories
browseable = no
writable = yes
; valid users = %S
; valid users = MYDOMAIN\%S

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

# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]
; comment = Network Logon Service
; path = /var/lib/samba/netlogon
; guest ok = yes
; writable = no
; share modes = no


# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
; [Profiles]
; path = /var/lib/samba/profiles
; browseable = no
; guest ok = yes


# A publicly accessible directory, but read only, except for people in
# the "staff" group
; [public]
; comment = Public Stuff
; path = /home/samba
; public = yes
; writable = yes
; printable = no
; write list = +staff
[myshare]
comment = This is share for sales dept
path = /share/smb
valid users = tom joy @smbgrp
force group = smbgrp
public = yes
writable = yes
printable = yes
create mask =0777
read only = yes
guest only = yes
guest ok = yes
browsable = yes

[root@server ~]#vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
(also enabled smb in firewall and my selinux is enables)

[root@server ~]#smbpasswd –a tom
[root@server ~]#testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[myshare]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[root@server ~]#usermod –a –G smbgrp root
[root@server ~]#usermod –a –G tom
[root@server ~]#smbpasswd –a root
[root@server ~]#smbpasswd –a tom
[root@server ~]#service network restart
[root@server ~]#service iptables restart
[root@server ~]#service smb restart
[root@server ~]#service nmb restart


From client(where my server and client both are centos 6.3,client ip is 192.168.0.2,successul when i ping to server)
But whenever im trying to connent the samba server from client pc...i am facing this problem..


[root@client ~]#smbclient //192.168.0.30/share/smb –u root
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
Server not using user level security and no password supplied.
tree connect failed: NT_STATUS_BAD_NETWORK_NAME

please help me to clear out.....

michaelk 03-24-2013 10:10 AM

You need to specify the share name versus the path i.e. myshare.

The are several ways to view shares but using smbclient:
smbclient -L servername (IP address)

security = share is depreciated and you should really user level. In share mode the password vs username is sent which is why you are seeing the no password sent error. You also should not use root.

http://www.samba.org/samba/docs/man/...erverType.html

sasaditya 03-24-2013 12:39 PM

and i forget to tell you that i also set smb (all booleans) on in selinux..
as your advise
[root@server /]# smbclient -L 192.168.0.30
Enter root's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]

Sharename Type Comment
--------- ---- -------
myshare Printer This is share for sales dept
IPC$ IPC IPC Service (Samba Server Version 3.5.10-125.el6)
Fax:2 Printer Fax
Microsoft_XPS_Document_Writer:1 Printer Microsoft XPS Document Writer
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]

Server Comment
--------- -------
HOSTNAME Samba Server Version 3.5.10-125.el6

Workgroup Master
--------- -------
WORKGROUP HOSTNAME

after your advice,i had change security = user at standalone server option and restart the service smb,nmb...when i type
[root@server ~]#smbclient //192.168.0.30/share/smb -U tom
this results
Enter tom's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
tree connect failed: NT_STATUS_BAD_NETWORK_NAME

michaelk 03-24-2013 04:39 PM

Quote:

smbclient //192.168.0.30/share/smb
Should be
smbclient //192.168.0.30/myshare -U tom

myshare is the share name and printable = yes should be deleted under this share.

My fault for not mentioning that you need to add a samba user via smbpasswd.

http://www.comptechdoc.org/os/linux/...ambausers.html

sasaditya 03-24-2013 08:30 PM

Quote:

smbclient //192.168.0.30/myshare -U tom
[root@server /]# smbclient //192.168.0.30/myshare -U tom
Enter tom's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
smb: \>


jai ho guru....thank you very much...its working...i really dont know that..i always mention
smbclient //192.168.0.30/share/smb -U tom.
after your suggestion and advice,i came to know my mistake....thank you...


All times are GMT -5. The time now is 08:21 PM.