Advertisment

Access Samba over the Web

author-image
PCQ Bureau
New Update

You have some files on a Linux box, which you need to access while you're away. Common ways to get around this puzzle would be to set up FTP accounts for you, provide yourself Telnet or SSH access and so on. But what if you have a number of user accounts on this box-let's say it is some kind of a file server-and you need to do this for every user on that machine? After a while, the task gets quite tedious and can even result in security-related problems. The way out is to continue using Samba and perform simple file sharing. Well, file sharing is easy using Samba. Now let's see how to use it over the Web.

Advertisment

For this purpose, we assume you have either PCQLinux 2004 or Fedora Core 3 installed. Let's call this PC 'linux1'. If you haven't already, install and configure Samba on it. We have given the latest Samba (3.0.10.2) on this month's PCQXtreme CD. Login to your Linux box as root and copy 'samba.tar.gz' RPMs to /root. Now untar and install the four packages inside using:

# tar -xvf samba.tar.gz && rpm -ivh samba*.rpm

Direct Hit!
Applies to: Linux administrators
USP:

Use the lightweight SMB2 to provide a CGI gateway between your Linux and Windows servers, and access your Samba shares
Links:

www.samba.org/samba/GUI
On PCQXtreme CD:

linux\smb2.tgz, linux\samba.tar.gz 
Advertisment

Now configure Samba according to your set up. We have included a Web-based tool called 'swat' to configure Samba in this set (samba-swat-3.0.10-2.i386.rpm). It is installed by default on port 901 and you can launch it from Mozilla using http://localhost:901. Refer to Linux on a Windows Network, PCQuest, March 2003 on how to set this up.

SMB2



We have a package called 'smb2' to act as a CGI gateway for us. It is there on this month's PCQXtreme CD as well. Copy smb2.tgz (this is nothing but a '.tar.gz') to your /root directory and untar it. Now run:

# cd smb2



# make smb2


# cp smb2 /var/wwwroot/cgi-bin/

Advertisment

If you haven't enabled (or have disabled) CGI processing in Apache, head over to /etc/httpd/httpd.conf and enable it (add 'AllowCGI') to the default website.

From another machine



From another machine on your LAN, fire up its Web browser and access 

Error Cause Solution
Error

connecting to host
The

computer you tried to access is either turned OFF or has its

file-sharing disabled. You can also get this error if you have a

firewall running.
Try

rebooting the machine. If that doesn't work, check whether

file-sharing is enabled and running. Finally check whether a

firewall is blocking the SMB ports (139 and 445); it should

not.
Error

connecting to share
The

shared folder is protected by a password.
Can't

help it. SMB2 cannot currently connect to shares that are password

protected.
Access

is denied
Either

too many users have connected to the SMB2 server or IP-address based

DENY policies are in effect.
Reconfigure

Samba and SMB2 to allow more 



users or grant the IP address access to your SMB2 box.
Advertisment

http://linux1/cgi-bin/smb2/

And now you would be able to see all your network. Yes, it is that simple and without having to restart anything!

Sujay V. Sarma

Advertisment