Networking / Beginners

Mounting the SMB File System

Linux exclusively supports mounting of the SMB file system. This is due to the support that Linux enjoys from its kernel. The mounted SMB file system can be used just like a normal network file system. The command used for mounting file system is as follows:

submount //server1/share /mnt/SMBfs mountpoint -o username=userx

In the preceding example, share is connected to host server1.

Mounting also can be done automatically at system boot. This is done by adding the following line in the /etc/fstab file:

//server1/share /mnt/SMB SMBfs defaults,username=userx 0 0

SAMBA Client Tools

Some tools used by SAMBA clients are useful and easy to use. These tools are discussed in the following sections.

nmblookup

The nmblookup tool is used to query a WINS server. In addition, it is used to list machines and works similarly to nslookup in DNS. To list specific machines, use the following statement:

nmblookup -U server -R 'machine_name'

To list all machines on the network, use the following statement:

nmblookup \*

The preceding statement uses * to query by broadcasting, but a \ (backslash) should precede it to protect it from shell expansion.

smbclient

The smbclient tool is used for retrieving files during a normal FTP operation. The smbclient tool uses the following command:

smbclient //machine1/share
	> cd directory123
	> get file123

To view shared services, you can use the following command:

smbclient -L hostx

You also can specify the username and password by using the -U option, as shown in the following example:

smbclient -U user1%unsafepassword

As you can see, the username and password fields are separated with a%. It is unsafe to mention password like this because anyone who can retrieve previous commands will be able to access the password easily.

[Previous] [Contents] [Next]