Mastering Red Hat Linux 9 [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Mastering Red Hat Linux 9 [Electronic resources] - نسخه متنی

Michael Jang

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید









Configuring Samba as a Client



With the samba-client-* and samba-common-* RPM packages, you can see the directories and printers shared from a Microsoft computer. You can connect to a shared directory in two basic ways: by mounting a shared Microsoft Windows directory on a local Linux directory, or by connecting to the shared directory in terminal mode, as if you were connecting to an FTP server. In addition, you need to know how to connect to a shared printer connected to a Microsoft computer.



Shared Samba Directory



It is easy to connect to a shared directory from a Microsoft server. As shown in Figure 29.1, all you need is the smbclient command, along with the name or IP address of the server. The command is slightly unusual; note the backslashes associated with the smbclient command.




Figure 29.1: Reviewing the shares from a Microsoft server




There are a number of interesting shares in this directory. If the appropriate permissions are set on the Microsoft server, you can mount any of these shared directories almost like an NFS directory. The difference is subtle. For example, the following command can mount the Downloads directory shared from the computer named laptop2 on the local directory /root/downloads. Linux follows up by requesting a password.


# mount ‘//laptop2/downloads’ /root/downloads
Password:


The mount command actually serves as a “front end” to the mount.smbfs command, from the samba-client RPM package. You could also substitute the smbclient command.






Note


Strictly speaking, you should specify the Samba file type for mount by using the -t smbfs switch; because mount is a "front end" for mount.smbfs, this is not required.




Since there is no username, this mount command will work only with a Microsoft Workgroup–style shared directory. In other words, this requires a shared directory from a Windows 95/98/ME computer—or a shared directory where the user Everyone is allowed access—and you need just the password associated with the shared directory (if required). (Microsoft Windows NT/2000/XP computers can also be configured in this manner.)


However, most networks are more restrictive. On Microsoft Windows servers, you can limit access to specific users and or groups. In that case, you must have a username and password with appropriate privileges to that directory. The -o option allows you to enter usernames, passwords, and more when specifying a share. I personally prefer to specify just the username in the command line so I don’t have to type the password in clear text in a terminal. Linux automatically prompts for a password.


# mount -o username=michael ‘//laptop2/downloads’ /root/downloads
Password:






Note


You can even provide variable levels of access; for example, you can configure read-only access for guest users, while providing full access to privileged users.




The specifications for a Windows server can get more complex. Some of the other available Samba mount options are shown in Table 29.2.


































Table 29.2: Samba mount -o Options


Option




Description




username=winuser




Allows you to specify the Microsoft username of an authorized user on the Microsoft server.




password=winpass




Lets you specify the Microsoft password associated with the privileged Microsoft user; if you enter only a username, you’re automatically prompted for a password.




credentials=file




Reads a username and password from a specified file, which you can protect, like /etc/shadow; useful for automatic mounting from files such as /etc/fstab. The syntax is:




username=winuser




password=winpass




uid=linuser




Allows you to set the Linux users who own the files on the mounted filesystem; can be a user ID number or a username.




workgroup=winwork




Lets you specify the workgroup with the shared directory.







Note


These commands assume that the name of the Microsoft Windows computer is listed in your DNS server or /etc/hosts file. You could substitute the IP address for the computer name.






Samba Terminal Mode



With the name of the Microsoft Windows computer and share, you can connect directly to that shared directory as if it were an FTP server. Once connected, you can upload and download files as well. For example, the command shown in Figure 29.2 connects to the directory I used for this book. Note how I use double quotes with the cd command to navigate to a two-word Windows XP directory.




Figure 29.2: The direct Samba connection




Also note the list of available commands. Many of these commands should look familiar from



Connecting to a Printer



Shared printers from Microsoft Windows computers should be easy to configure in Linux. If the browse functionality of your Microsoft network is working, you’ll be able to select the printer with the redhat-config-printer wizard, in the Queue Type screen, as described in Chapter 25.


But this is not always possible. Microsoft browsing may have trouble finding your printer on a timely basis. Or you might have forgotten to make your printer browsable. You can configure a standard local printer and change the settings later. For example, Figure 29.3 illustrates a standard printer that I configured locally.




Figure 29.3: A redhat-config-printer local printer




It’s easy to change this to point to a remote printer; you simply click on the Queue Type drop-down box. From the resulting list, select Networked Windows (SMB) printer.


The format required to connect to a Samba printer is illustrated in Figure 29.4. Each entry is described in Table 29.3.




Figure 29.4: Configuring a Samba print queue






























Table 29.3: Information for Connecting to a Shared Samba Printer


FIELD




Description




Share




The share name in the //servername/printername format.




Server Name Or IP Address




The name or IP address of the computer that’s sharing the printer.




Workgroup




The Windows workgroup name; enter only if the Windows server is in a workgroup.




User




The Microsoft username of the authorized user.




Password




The Microsoft password associated with the user.







/ 220