The SMB Client program—smbclient—is used to connect your Linux machine to networked SMB servers: for example, those running Windows NT.
Smbclient is a command-line program with many options.
To display smbclient syntax:
1. | Open a terminal window. |
2. | At the command prompt, type /usr/bin/smbclient | more
The possible commands and flags will be piped to more and displayed one screen at a time (Figure 13.35). |
To establish a typical connection:
Tip
Table 13.2 lists some of the commonly used smbclient command flags.
Common smbclient command flags | |
---|---|
Flag | Comment |
-L host | Displays a list of resources available on the host |
-I IP Address | Causes smbclient to use the IP address rather than a host name look up |
-N | Used when a password is not required |
-U Username | Use the specified user name, rather than the Linux logon ID. Passwords are specified using a percent sign. For example, if you were logged on as root, you could issue the following command to connect as juser: |
smbclient \theserver tmp –U juser%passwd | |
-W Workgroup | Specifies the workgroup on the remote SMB server |
Tip
Once you are connected to a file resource, there are a number of commands available for manipulating files and directories. These are pretty much like the command-line FTP commands (see "Using FTP" earlier in this chapter). Some of the more common commands available for file operations are listed in Table 13.3.
File Operation Commands | |
---|---|
Command | Comment |
cd | Changes the directory |
del | Deletes a file |
dir | Lists a directory |
get | Gets a remote file and saves it on the local system |
lcd | Changes the local directory |
mkdir | Creates (makes) a directory on the remote resource |
put | Puts local files on the remote resource |
quit | Exits smbclient |