LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 08-09-2006, 07:22 PM   #1
townlevel
LQ Newbie
 
Registered: Mar 2006
Posts: 2

Rep: Reputation: 0
How do I check if smbfs is accessible from Win Clients using a linux script


I am trying to write a PHP script (hosted on linux/apache/smb server) to automatically check if //NETBIOSNAME/SHARE (a samba smbfs share) is definitely accessible to windows clients before writing stuff to the unix mount point for the said share.

If I just check the linux mountpoint (e.g. /win_mounts/sharename) exists that doesn't tell me that //NETBIOSNAME/SHARE is still mounted to it.

Nor will PHP let me check using for example is_writable('//NETBIOSNAME/SHARE') from a linux hosted apache web server, it only lets me check the linux file system (i.e. the mount point, not if it's actually mounted).

smbclient I hear you cry, however smbclient always takes you to a smbclient /> command prompt and I have been unable to find any way to
bypass this 'smbclient />' command prompt, which requires human input to execute smbclient commands and cannot it seems be executed by passing a line of code and options to it.

Does anyone have any suggestions on either how to supress the command prompt interface of smbclient so it returns results from single line requests, or have some other ideas on how to test if a windows share is mounted on the unix/linux file system and will be visible to windows clients ?

I welcome your thoughts

Many thanks
 
Old 08-10-2006, 08:59 PM   #2
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian PPC/i386/AMD64 6/7, Vista, XP , WIN7, Server 03/08
Posts: 1,287

Rep: Reputation: 97
Been a while since I used smbclient, however, i believe you can specify all the information in the command line i.e. <Quote>smbclient -u scheidel -p 5555555 //WINS_Name/ShareName/</Quote>

Alex
 
Old 09-05-2006, 06:44 PM   #3
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 231Reputation: 231Reputation: 231
From man smbclient
Quote:
-c command string
command string is a semicolon-separated list of commands to be executed instead of prompting from stdin. -N is implied by -c.
 
Old 09-06-2006, 11:43 PM   #4
townlevel
LQ Newbie
 
Registered: Mar 2006
Posts: 2

Original Poster
Rep: Reputation: 0
Voila - it works

My problem is now solved.

Many thanks archtoad.

Both the -c and also the discovery that commands would only work when enclosed in quotes has finally got this working as I wanted.

For ages I'd either not used quotes or put them in the wrong place, enclosing each command for example, but this example finally works:

smbclient //COMPNAME/SHARENAME -U win_user%win_pass -c 'cd subdir;put file.txt;ls ./;'

I take back everything I said about smbclient being a worthless a piece of sh**

Many thanks for your replies.
 
Old 09-28-2006, 02:51 PM   #5
nick1
Member
 
Registered: Oct 2004
Posts: 47

Rep: Reputation: 15
THANK YOU SO MUCH for posting your example! Those darn '' were driving me nuts!

*Nick*
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux gateway - It doesn't allow run logon script of all clients to win2k3 b:z Linux - Networking 1 04-21-2005 11:17 PM
putting shell script accessible in all directory demmylls Linux - General 1 02-23-2004 10:37 AM
Pop-up messages for Win clients? J_Szucs Linux - Software 2 11-13-2003 02:22 AM
Linux server and clients Win and Linux, some doubts... geraldomanaus Linux - Networking 1 03-14-2003 06:11 AM
how to check Dial in server clients xtian500 Linux - Networking 1 11-23-2001 12:05 AM


All times are GMT -5. The time now is 09:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration