Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 1996 12:54:19 -0500
From:      "Mark J. Taylor" <root@spiffy.cybernet.com>
To:        "Jordan K. Hubbard" <jkh@time.cdrom.com>
Cc:        Daniel Leeds <cosmos@sponsor.octet.com>, <hackers@freebsd.org>
Subject:   Re: samba and win95
Message-ID:  <XFMail.960111120258.root@spiffy.cybernet.com>
In-Reply-To: <8510.821325314@time.cdrom.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 01/11/96 03:16:58 Jordan K. Hubbard wrote:
>>> anyone here using samba with windows95?  im not having success in being 
>> able to mount my win95 machine from freebsd using smbclient.  win95 
>> machine can mount freebsd machine fine tho.
>
>I've only done it in that direction as well.  Are you sure samba is
>"two way" like this? :-)
>
>					Jordan

I use smbclient all the time to access files on Win '95 and NT machines from
my FreeBSD machines.  I even have a cool CGI script (written in /bin/sh)
to give me access to these files and directories.  It's kinda cool-
it presents an interface a lot like ftp://xxx.yyy.zzz/ would.  Anyone interested?
It currently uses guest access.  Could be modified to use another name, and
prompt for a password.  Since it is so short, I'll put it here (please feel
free to modify and redistribute it- it could use some error checking put in):



#!/bin/sh
# sambadir
# samba directory script
# use:  http://xxx.com/cgi-bin/sambadir?::server:resource[:dir[:dir[...]]]
# note: spaces in server, resource, or dir names must be replaced with '+'
#       symbol.  This script does it automatically.
echo Content-type: text/html
echo

server=`echo "$*" | awk -F : '{print "\\\\\\\\" $3 "\\\\" $4}'`
dir=`echo "$*" | awk -F : '{for (i=5; i<=NF; i++){if (i>5){printf ":"}; printf $
i}}' | /usr/bin/sed 's#:#\\\\#g'`
path=`echo "$*" | /usr/bin/sed 's# #+#g'`

echo "<HTML><HEAD>"
echo "<TITLE>Directory listing of $server:$dir</TITLE>"
echo "</HEAD><BODY>"

printf "cd \"%s\"\ndir\n" "$dir" | /usr/local/samba/bin/smbclient $server -U gue
st -N | awk 'BEGIN{done=0}/blocks available/{done=1}{if ((NR>5) && (!done)) prin
t $0}' | awk '/DA/{print "d " $0; continue}/ /{print "f " $0; continue}' | /usr/
bin/colrm 38 | awk -v path="$path" '/^d/{printf "<IMG SRC=\"/icons/dir.gif\" ALT
=\"DIR \"><A HREF=\"/cgi-bin/sambadir?"path":"; for (i=2; i<NF; i++){printf $i"+"}
; printf $NF "\">"; for (i=2; i<NF; i++){printf $i" "}; printf $NF "</A><BR>\n";
 continue}/^f/{printf "<IMG SRC=\"/icons/text.gif\" ALT=\"FILE\"><A HREF=\"/cgi-
bin/sambafile?"path":"; for (i=2; i<NF; i++){printf $i"+"}; printf $i "\">"; for (
i=2; i<NF; i++){printf $i" "}; printf $NF "</A><BR>\n"}'

echo "</BODY></HTML>"




#!/bin/sh
# sambafile
# samba file access script
# use:  http://xxx.com/cgi-bin/sambafile?::server:resource[:dir]:file
# note: spaces in server, resource, or dir names must be replaced with '+'
#       symbol.

echo Content-type: text/plain
echo

server=`echo "$*" | awk -F : '{print "\\\\\\\\" $3 "\\\\" $4}'`
dir=`echo "$*" | awk -F : '{for (i=5; i<NF; i++){if (i>5){printf ":"}; printf $i
}}' | /usr/bin/sed 's#:#\\\\#g'`
file=`echo "$*" | awk -F : '{print $NF}'`

printf "cd \"%s\"\nget \"%s\" -\n" "$dir" "$file" | /usr/local/samba/bin/smbclie
nt $server -U guest -N -E 2> /dev/null


When I get it all spiffied up, I'll post it again.



-Mark Taylor
mtaylor@cybernet.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.960111120258.root>