Building Tablet PC Applications (Pro-Developer)
You can share files from a Linux computer in many ways. Generally, you configure a server and then share files through a directory. The four major types of Linux sharing servers are FTP, NFS, Samba, and Apache. If you ve enabled NIS, it also shares configuration files. While there are graphical configuration tools available for each of these services, they all can be set up from the command-line interface as well, and they each include regular text commands for the client and server. For detailed information on these services, see Chapters 27 “ 30 .
FTP Servers
The basic FTP commands are covered in detail in Chapter 27 . This section summarizes associated commands and configuration files.. While the Red Hat Linux 9 Installation CD now includes only vsFTP, WU-FTP is a popular option also available in RPM format. The vsFTP server comes highly recommended; Red Hat uses it on its own FTP servers.
vsFTP Commands and Configuration Files
The vsFTP package includes its own set of configuration files. It is simpler than alternative servers such as WU-FTP; the only command you need is the vsftpd daemon. The vsFTP server is now a regular service in the /etc/rc.d/init.d directory; it is no longer an xinetd service. If both servers are installed, be sure to activate only one at a time. The vsFTP configuration files are shown in Table A.29.
File | Description |
---|---|
/etc/vsftpd.conf | The primary configuration file. |
/etc/vsftpd.ftpusers | A list of users not allowed to log in; should include service-level users such as news, bin, and mail, as well as root. |
/etc/vsftpd.user_list | A list of allowed or denied users, depending on the userlist_deny variable in /etc/vsftpd.conf . |
WU-FTP Commands and Configuration Files
One major alternative to vsFTP is WU-FTP, which you can download through the home page of their development group at www.wu- ftpd .org or the resource center at www.landfield.com/wu-ftpd/ . The commands shown in Table A.30 are available to help you manage a WU-FTP server. Remember, WU-FTP is an xinetd service that you also need to activate through the wu-ftpd file in the /etc/ xinted.d directory. Alternatively, you can use chkconfig to activate this service.
Command | Description |
---|---|
ckconfig | Checks the integrity of the configuration files. |
ftpcount | Lists the number of connections. |
ftpwho | Lists connected users and origin IP addresses. |
ftprestart | Stops and restarts an FTP server. |
ftpshut | Allows you to shut down an FTP server now or at a specified time. |
in.ftpd | Starts the FTP server daemon. |
in.wuftpd | Starts the WU-FTP server. |
privatepw | Adds and deletes FTP groups from /etc/ftpgroups; these groups need to correspond to a real group in /etc/group . |
The WU-FTP server also has a group of configuration files, as shown in Table A.31. You might recall from Chapter 27 that the functionality of some of these files is now part of /etc/ftpaccess .
File | Functionality |
---|---|
/etc/ftpaccess | Opens the basic WU-FTP configuration file. |
/etc/ftpconversions | Lists commands that are run automatically during FTP uploads or downloads. |
/etc/ftpgroups | Defines special groups with a specific password, defined through the privatepw command. |
/etc/ftphosts | Allows or denies access to a specific user account. |
/etc/ftpusers | Allows or denies access to specific users. |
FTP Client
There are a number of FTP clients available; all that I ve seen are front-ends to the FTP text client. The list of available FTP client commands is quite varied. The more important commands were addressed in Chapter 27 . A fuller list follows in Table A.32. This is just a basic list, without options. You can get more information from the ftp > prompt by entering help command .
Command | Description |
---|---|
! | Escapes to the shell; the !ls -l command gives you a full list of files in the current local directory. |
$ | Executes a macro. |
append | Appends a file to another file; e.g., the append local remote command adds the contents of the local file to the remote file. |
ascii | Sets file transfer to ASCII mode. |
bell | Toggles a beep when a command, such as a file transfer, is complete. |
binary | Sets file transfer to binary mode. |
bye | Exits the current FTP session. |
cd | Changes the directory. |
cdup | Moves up one directory level. |
close | Closes the connection without exiting FTP. |
delete | Deletes the specified file on a remote directory. |
dir | Equivalent to ls “l . |
exit | Closes connection and exits FTP. |
get | Copies a file from the FTP server. |
hash | Toggles the use of hash marks, so you can monitor the progress of a file transfer. |
lcd | Changes the working directory on the local computer. |
ls | Equivalent to ls -l in the bash shell. |
mdelete | Deletes multiple files. |
mdir | Takes the contents of a remote directory and outputs them to a local file. |
mget | Copies multiple files from the FTP server. |
mkdir | Creates a new directory on the FTP server. |
mput | Sends multiple files to the FTP server. |
newer | Uses the get command if the remote file is newer. |
open | From the FTP prompt, connects to a remote FTP server. |
put | Copies a file to the FTP server. |
pwd | Lists the working directory on the FTP server. |
quit | Exits the FTP shell. |
rename | Renames a file on the FTP server. |
rmdir | Removes a remote directory. |
status | Checks the status of the connection. |
system | Shows the basic system type, usually Unix. |
user | Logs in as a user. |
NFS Commands
The Network File System (NFS) is used to share directories between Linux and Unix computers. The basic configuration process is described in detail in Chapter 28 ; Table A.33 summarizes some important commands.
Command | Description |
---|---|
exportfs | Exports and maintains the list of available NFS directories, based on /etc/exports . |
nfsstat | Returns information on shared NFS directories; the output from this command is a good place to look for connection problems. |
nhfsstone | Tests the load on an NFS server. |
rpc. mountd | Starts the NFS mount daemon, the service that actually checks mount requests against what s allowed in /etc/exports . |
nhfsrun | Tests program; runs nhfsstone with a range of demands on the server. |
showmount | Shows available directories from an NFS server. |
NIS Commands
The Network Information System (NIS) allows you to set up a single database of key configuration files such as /etc/passwd in a LAN of Linux and Unix computers. The basic configuration process is described in detail in Chapter 28 ; the important commands are summarized in Table A.34. Many key NIS commands are in an unusual directory, /usr/lib/yp . If you use NIS, you might consider adding that directory to your PATH with the PATH=$PATH:/usr/lib/yp command.
Command | Description |
---|---|
create_printcap | Processes an LPD file such as /etc/printcap to an NIS database map; does not process a CUPS printer configuration file. |
makedbm | Creates an NIS database file. |
match_printcap | Works with the printcap_path in /etc/lpd.conf; does not process a CUPS printer configuration file. |
mknetid | Generates an NIS database map from key configuration files: /etc/passwd , /etc/group , and /etc/ hosts . |
pwupdate | Updates the NIS database map for regular and shadow passwords. |
revnetgroup | Generates reverse NIS netgroup data. |
ypcat | Reads files from an NIS server database. |
ypchfn | Changes a user s finger information in the NIS database. |
ypchsh | Changes a user s default shell in the NIS database. |
ypinit | Builds a database for a master or slave NIS server. |
ypmatch | Searches for a user in the NIS database. |
yppasswd | Changes a password in the NIS database. |
yppush | Replicates an NIS master database to an NIS slave server. |
ypxfr | Copies an NIS database; common for NIS slave servers. |
Samba Commands
Samba lets you configure Linux to connect and share directories with Microsoft Windows computers. Linux and Unix computers can also use Samba to share directories with each other.
As discussed in Chapter 29 , you could use the SWAT utility to configure Samba. SWAT is certainly a rich and detailed tool. But remember, like other GUI tools, it is just a front end to a group of commands. There are a substantial number of Samba commands ”some related to the server, others used commonly by Samba clients.
Samba Server Commands
When you configure a Samba server, you re sharing directories and printers in a format compatible with Microsoft Windows. Important Samba server commands are shown in Table A.35.
Command | Description |
---|---|
make_unicodemap | Specifies a translation ”from DOS or Unix text to 16-bit Unicode. |
mksmbpasswd.sh | Starts a script that directly edits the SMB password file, /etc/samba/smbpasswd . |
smbadduser | Sets up a database entry between a Linux user and a Microsoft Windows user; prompts for a password and enters the result in /etc/ smbusers and /etc/smbpasswd . |
smbcontrol | Allows you to send messages to an SMB server, such as debug, elections , and ping messages. |
smbpasswd | Changes a user s Samba password; can apply to local or remote Samba servers. |
smbstatus | Displays the status of connections to the local SMB server. |
testparm | Checks the syntax of smb.conf . |
testprns | Checks a proposed Samba share name for a printer. |
winbindd | Starts the name service daemon for Microsoft Windows “style server names . |
Samba Client Commands
When you configure a Samba client, you re using commands on a Linux or Unix computer to connect to a shared Samba or Microsoft Windows directory. Important Samba client commands are shown in Table A.36.
Command | Description |
---|---|
mount.smb | Allows you to use the mount command as a front end to connect to a shared Samba directory. |
nmblookup | Searches for the IP address associated with a NetBIOS name. |
rpcclient | Permits connections to remote procedure calls on a Microsoft Windows server. |
smbcacls | Allows you to view and set the Access Control List on a Microsoft Windows server. |
smbclient | Lets you connect directly to a Samba server, with an FTP-style interface. |
smbmount | Mounts a Samba filesystem; you can use the mount command as a front end to this command. |
smbprint | Sends a print job to a shared printer on a Samba server. |
smbumount | Unmounts a shared Samba directory. |
Apache Commands
Apache is the most popular web server on the Internet, as well as the default web server for Red Hat Linux. As discussed in Chapter 30 , the standard way to configure Apache is by editing the /etc/httpd/conf/httpd.conf configuration file. Commands are available to help you work with whatever Apache configuration you use. Some of the more important ones are listed in Table A.37.
Command | Description |
---|---|
ab | A tool for testing the performance of your Apache server. |
apachectl | A control script for your Apache server. |
htdbm | A new Apache 2.0 tool for managing authorized user/password databases. |
htdigest | A tool that creates an authentication database of users and passwords. |
htpasswd | A tool that allows you to set up individual users and passwords for your web server. |
httpd | The Apache daemon; httpd -t tests the syntax of your httpd.conf configuration file. |
logresolve | A tool that performs a reverse name lookup for Apache log files, so you know the computers or domains that are connecting to your server. |
rotatelogs | A tool that rotates Apache log files automatically; otherwise , to use the standard logrotate job, which is governed by cron , you d have to stop the Apache server. |