6.4. Using Samba

6.4. Using Samba

The Samba service was created mainly for Windows users; however, Linux users have also appreciated all the advantages of this technology, especially because the file sharing implemented in Linux is no worse , and sometimes is even better, than in Windows. The smbclient command is used to work with Samba from Linux.

To connect to the server, at least two options have to be specified: -L (a server's address) and -U (a user name ). In response, the program asks you to enter the password. If you are using encryption, enter the system password; otherwise , enter the password specified when transferring the user to the /etc/samba/smbpasswd file (with the smbpasswd command).

To test the server, execute the following command:

 smbclient -L localhost -U root 

The system will respond by displaying all shared resources of the server. The result will look similar to this:

 Domain=[MYGROUP] OS=[Unix] Server=[Samba 2.2.3a]        Sharename       Type       Comment        ---------       ----       ----------        IPC$            IPC     IPC Service (Samba Server)        ADMIN$          Disk    IPC Service (Samba Server)        Server        Comment       ---------     ----------        FLENOVM       Samba Server        Workgroup     Master        ---------   ----------        MYGROUP       FLENOVM 

Note that not all directories are shown in this list. For example, the value of the browseable parameter for home directories in the [ homes ] directory is set to no (see Section 6.2.1 ). This means that these directories will not be shown. This is quite logical, because unauthorized people should not be allowed to view directory names, especially if they correspond to user names or if the directories contain confidential data. Never change this parameter so that hackers will not know what to hack.

To connect to a server's public resource, enter the smbclient command, passing to it the name of the resource in the Universal Naming Convention (UNC) format as follows :

 \ServerName\Resource 

For example, say you want to connect to the home directory of the flenov user. It address is \\192.168.1.1\flenov.

Some explanation is in order. In Linux, the backslash is a service character; thus, each backslash has to be doubled . Accordingly, the command to connect to the resource will look as follows:

 smbclient \\192.168.1.1\flenov 

When accessing a resource requiring authorization, the user name possessing the rights to the resource has to be specified:

 smbclient \\192.168.1.1\flenov -U flenov 

If the connection to the server is successful, the server will respond with the prompt, at which various file-handling commands can be entered. The prompt looks as follows:

 Smb: \> 

Entering the help command or a question mark displays the available commands. These are similar to FTP commands (see Chapter 10 ). To disconnect from the resource, execute the exit command.

Most distributions include a barebones standard Samba packet. But on the Internet, third-party enhancement products can be found, for example, to allow shared resources to be mounted onto the Linux file system as a diskette or a CD-ROM is, or to work with the shared resources in graphical mode the way it is done in Windows.



Hacker Linux Uncovered
Hacker Linux Uncovered
ISBN: 1931769508
EAN: 2147483647
Year: 2004
Pages: 141

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net