Sharing Windows Drives Using a Linux Samba Client
Up to this point I have focused on your Linux server being a Samba server, but it can also mimic a Windows client using Samba's client software.
For example, you can also access a CD-ROM, DVD, Zip, floppy, or hard drive installed on a Windows machine from your Linux box. In this section I'll show you how to share a CD-ROM drive.
Windows Setup
The Windows client box should be set up first as a member of a Samba domain or workgroup. The next step is to make the CD-ROM drive shared. The steps you use depend on which version of Windows you have.
For Windows 98/ME:
1. | Double-click My Computer.
| 2. | Right-click on the CD-ROM drive, and choose Sharing.
| 3. | Set the Share Name as cdrom with the appropriate access control.
| 4. | Restart Windows.
|
For Windows 2000:
1. | Double-click My Computer.
| 2. | Right-click on the CD-ROM drive, and choose Sharing.
| 3. | Set the Share Name as cdrom with the appropriate access control.
| 4. | Log out, and log in again as normal using your current login.
|
Finally, for Windows XP:
1. | Double-click My Computer.
| 2. | Right-click on the CD-ROM drive, and choose Sharing and Properties.
| 3. | Set the Share Name as cdrom, and set the appropriate access control.
| 4. | Log out and log in again as normal using your current login.
|
After you have completed this task, you'll have to go to the next step of testing your configuration.
Test Your Windows Client Configuration
Use the smbclient command to test your share. You should substitute the name of your Windows client PC for "WinClient," and in place of "username" provide a valid workgroup/domain username that normally has access to the Windows client. You should get output like this when using the username's corresponding password:
[root@bigboy tmp]# smbclient -L WinClient -U username
added interface ip=192.168.1.100 bcast=192.168.1.255
nmask=255.255.255.0
added interface ip=127.0.0.1 bcast=127.255.255.255 nmask=255.0.0.0
Got a positive name query response from 192.168.1.253 ( 192.168.1.253
)
Password:
Domain=[HOMENET] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
Sharename Type Comment
--------- ---- -------
IPC$ IPC Remote IPC
D$ Disk Default share
print$ Disk Printer Drivers
SharedDocs Disk
cdrom Disk
Printer2 Printer Acrobat PDFWriter
ADMIN$ Disk Remote Admin
C$ Disk Default share
Server Comment
--------- -------
Workgroup Master
--------- -------
You can get the same result with
[root@bigboy tmp]# smbclient -L WinClient -U username%password
but this method is less secure as your password is echoed on the screen.
Create a CD-ROM Drive Mount Point on Your Samba Server
You'll now need to create the mount point on the Linux server to mount and access the CD-ROM drive. In this case, I've named it /mnt/winclient-cdrom, and you'll use the mount command to get access to this device from the Linux server.
Password Prompt Method
The Linux mount command will try to access the CD-ROM device as user username by using the username[eq] option. You will be prompted for a password:
[root@bigboy tmp]# mkdir /mnt/winclient-cdrom
[root@bigboy tmp]# mount -t smbfs -o username=username \
//winclient/cdrom /mnt/winclient-cdrom
No Prompt Method
Linux won't prompt you for a password if you embed the access password into the mount command string along with username:
[root@bigboy tmp]# mkdir /mnt/winclient-cdrom
[root@bigboy tmp]# mount -t smbfs -o \
username=username,password=password \
//winclient/cdrom /mnt/cdrom
The smbmount Command Method
Some versions of Linux support the smbmount command to mount the remote drive. Incompatible versions will give errors like this:
[root@bigboy tmp]# smbmount //winclient/cdrom \
/mnt/winclient-cdrom -o username=username
Password:
27875: session setup failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed
To be safe, stick with using the Linux mount command.
|