# sleep (Web site development) for a few seconds so we

December 14th, 2007

# sleep for a few seconds so we don t overload the mailer # On fast systems or systems with few accounts, you can # probably take this delay out. sleep 2 end The script accepts two parameters. The first is the subject of the e-mail message, which is enclosed in quotes. The second is the name of the file containing the text message to send. Thus, to send an e-mail message to all users warning them about an upcoming server hardware upgrade, I may do something similar to the following. mailfile “System upgrade at 5:00pm” upgrade.txt The file upgrade.txt contains the text of the message to be sent to each user. The really useful thing about this approach is that I can save this text file and easily modify and resend it the next time I upgrade the system. Tip If your users log in to your system using text-based logins instead of graphical logins, you can add messages to the /etc/motd file to have them reach your users. Any text in that file will be displayed on each user s screen after the user logs in and before the first shell prompt appears. Summary It is not uncommon for a Red Hat Linux system to be used as a single-task server with no actual users. It sits quietly in a server room, serving Web pages or handling domain name service, never crashing, and rarely needing attention. This is not always the case, however. You may have to support users on your Red Hat Linux server, and that can be the most challenging part of your system-administration duties. Red Hat Linux provides a variety of tools that help you with your administrative chores. The useradd, usermod, and userdel commands enable easy command-line manipulation of user account data. Furthermore, creating a support mailbox and building shell scripts to automate repetitive tasks lightens your load even more. Red Hat Linux builds on top of the rich history of UNIX and provides an ideal platform to support the diverse needs of your users.
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Web hosting provider - Sending Mail to All Users Occasionally, you need

December 13th, 2007

Sending Mail to All Users Occasionally, you need to send messages to all users on your system. Warning users of planned downtime for hardware upgrades is a good example. Sending e-mail to each user individually is extremely time consuming and wasteful; this is precisely the kind of task that e-mail aliases and mailing lists were invented for. Keeping a mailing list of all the users on your system can be problematic, however. If you are not diligent about keeping the mailing list current, it becomes increasingly inaccurate as you add and delete users. Also, if your system has many users, the mere size of the alias list can become unwieldy. The following script, called mailfile, provides a simple method of working around these problems. It grabs the login names directly from the /etc/passwd file and sends e-mail to all the users. #!/bin/csh # # mailfile: This script mails the specified file to all users # of the system. It skips the first 17 accounts so # we do not send the email to system accounts like # root . # # USAGE: mailfile “Subject goes here” filename.txt # # Check for a subject # if ( `echo $1 | awk { print $1 } ` == “” ) then echo You did not supply a subject for the message. echo Be sure to enclose it in quotes. exit 1 else # Get the subject of the message set subject=$1 endif # # Check for a filename # if ( $2 == “” ) then echo You did not supply a file name. exit 2 else # Get the name of the file to send set filename=$2 endif # # Check that the file exists # if ( -f $filename ) then echo Sending file $filename else echo File does not exist. exit 3 endif # # Loop through every login name, but skip the first 17 accounts # foreach user ( `awk -F: { print $1 } /etc/passwd | tail +17` ) # Mail the file echo Mailing to $user mail -s “$subject” $user < $filename
Check Tomcat Web Hosting services for best quality webspace to host your web application.

# # Loop through every login name, but (Web site design)

December 13th, 2007

# # Loop through every login name, but skip the first 17 accounts # foreach user ( `awk -F: { print $1 } /etc/passwd | tail +17` ) # Get the users home directory set dir=`grep “^”$user”:” /etc/passwd | awk -F: { print $6 } ` # Find out home much disk space the home dir is using set usage=`du -s $dir | awk { print $1 } ` # Check if the space used exceeds the max allowed if ( $usage > $maxusage ) then # # Send a warning message to the user # set subject=”Warning! You are using $usage KB of disk space” mail -s “$subject” $user < /usr/local/etc/quota.txt # print the violators to the screen echo User $user is using $usage KB of disk space endif end The maximum amount of disk space allowed for each user is defined in the variable maxusage. It is set to 5000KB in this example; feel free to change that to whatever makes sense for your situation. Simply modify the set maxuser= line located toward the top of the file. When run, the script mails the file /usr/local/etc/quota.txt to the users exceeding the quota. The quota.txt file may contain a message similar to the following: You have exceeded the maximum allowed disk quota of 5000 kilobytes. Please remove any unnecessary files from your home directory. You can log in as root and run the script manually, or add the script to the root cron jobs so that it automatically runs on a regular basis. (The cron facility is described in detail in Chapter 12.) To do that, run the crontab -e command as root and add the following line to the crontab file. 0 3 * * * /usr/local/bin/quota.csh The quota.csh script will now automatically run once a day at 3:00 a.m. This method of enforcing quotas actually has some advantages over implementations built into the operating system. Built-in quotas stop a user from creating new files when his or her quota is exceeded. To that user, it is effectively the same as if the disk has become full. This inevitably results in a support call to the system administrator. The quota.csh script, however, does not suffer from this problem. Users can temporarily exceed the quota if they need to; they are simply be nagged with automated e-mail messages until they reduce their file usage to acceptable levels again. In this respect, you can think of it as a "kinder and gentler" quota system. Caution When typing in the quota.csh script, pay close attention to the type of quote characters being used. The script uses two different types of single quote character, and the type used is significant; they are not interchangeable. The backward slanting quote character (usually located just below Esc on your keyboard) is used in several places. It is the outermost set of quotes on the "foreach user" line, the "set dir" line, and the "set usage" line, causing the text it surrounds to be interpreted as a command. The other type of single quote (located on the double quote key) causes the text to be interpreted literally but does not cause it to run as a command.
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Web site translator - by user mary. Run the rm command to

December 12th, 2007

by user mary. Run the rm command to delete each of those files. find / -user mary -exec chown jenny {} ; Search for all files and subdirectories under /home that are owned by user mary and run the chown command to change each file so that it is owned by jenny instead. find / -uid 500 -exec chown jenny {} ; This command is basically the same as the previous example, but it uses the user ID number instead of the user name to identify the matching files. This is useful if you have deleted a user before converting her files. There are a few common things about each invocation of the find command. The first parameter is always the directory to start the recursive search in. After that come the file attributes to match. We can use the -print option to just list the matching files, or the -exec parameter to run a command against each matching file or directory. The {} characters designate where the matching filename should be filled in when find runs the -exec option. The ; at the end simply tells Linux where the command ends. These are only a few of find s capabilities. I encourage you to read the online man page to learn more about find. (Type man find to view the page.) Checking Disk Quotas Limited disk space can be another source of user support calls. A stock Red Hat Linux system lacks true disk quotas, so it is possible for a single user to use up an entire disk, causing problems for the rest of the users. The duty then falls on the system administrator to recover enough disk space for everyone to keep working. The long-term solution is to install a larger hard drive, but in the short term, the solution is usually to contact individual users and convince them to remove unneeded files. You can discover the most voracious consumers of disk space using the du command. Invoke du with the -s option and give it a list of directories; it reports the total amount of disk space used by all the files in each directory. You can thus use the du command to list the total disk space used by each subdirectory within the /home directory. Try the following: # du -s /home/* This should result in a list of all of your users home directories preceded by the number of kilobytes that each directory structure uses, generally similar to this: 60 /home/bob 1 /home/jane 1960 /home/joe 7 /home/mary 9984 /home/thad Of course, manually checking the disk usage of every user on a regular basis is a real pain in the neck. Fortunately, Red Hat Linux lets you automate this sort of thing. The following is a script that uses du to check the home directory of every user on your system. You could put this script in an accessible location, such as /usr/local/bin/quota.csh. (Shell scripts are described in Chapter 12.) #!/bin/csh # # quota.csh: This script scans the home directories of all # nonsystem accounts and e-mails a warning message # to any user that is consuming an excessive # amount of disk space. # set the maximum space per home directory to 5000 kilobytes. set maxusage=5000
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Http web server - Specify a new command shell to use with

December 12th, 2007

Specify a new command shell to use with this account. Replace shell with the full path to the new shell. -u user_id Change the user ID number for the account. Replace user_id with the new user ID number. Unless the -o option is used, the ID number must not be in use by another account. Assume that a new employee named Jenny Barnes will be taking over Mary s job. We want to convert the mary account to a new name (-l jenny), new comment (-c “Jenny Barnes”), and home directory (-d /home/jenny). We could do that with the following command: # usermod -l jenny -c “Jenny Barnes” -m -d /home/jenny mary Furthermore, if after converting the account we learn that Jenny prefers the tcsh shell, we could make that change with the -s option (-s /bin/tcsh): # usermod -s /bin/tcsh jenny Alternatively, we could use the chsh command to change the shell. The following is an example: # chsh -s /bin/tcsh jenny The chsh command is handy because it enables a user to change his or her own shell setting. Simply leave the user name parameter off when invoking the command, and chsh assumes the currently logged-in user as the account to change. Deleting User Accounts Occasionally, it is necessary to remove a user account from your Red Hat Linux system. This can be done with the userdel command. The userdel command takes a single argument, which is the login name of the account to delete. If you supply the optional -r option, it also deletes the user s home directory and all the files in it. To delete the user account with login name mary, you would type this: # userdel mary To wipe out her home directory along with her account, type this: # userdel -r mary Files owned by the deleted user but not located in the user s home directory will not be deleted. The system administrator must search for and delete those files manually. The find command comes in very handy for this type of thing. I won t describe all the capabilities of the find command (that would take a very fat chapter of its own). I do, however, provide a few simple examples of how to use find to locate files belonging to a particular user, even when those files are scattered throughout a file system. You can even use the find command to delete or change the ownership of files, as they are located. Table 11-4 has a few examples of the find command in action. Table 11-4: Using find to Locate and Change User Files Find Command Description find / -user mary -print Search the entire file hierarchy (start at /) for all files and directories owned by mary and print the filenames to the screen. find /home -user mary -exec rm {} ; Search for all files and subdirectories under /home that are owned
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

If you must reset a user s (Vps web hosting) password, do

December 11th, 2007

If you must reset a user s password, do so with the passwd command. While logged in as root, type passwd followed by the login name you are resetting. You are prompted to enter the password twice. # passwd mary After resetting the password, set it to expire so that the user is forced to change it the next time she logs in. You can use the chage command to set an expiration period for the password and to trick the system into thinking that the password is long overdue to be changed. # chage -M 30 -d 0 mary The -M 30 option tells the system to expire Mary s password every 30 days. The -d 0 option tricks the system into thinking that her password has not been changed since January 1, 1970. Cross-Reference You can read more about password security and the chage command in Chapter 14. Modifying accounts Occasionally, a user needs more done to an account than just a resetting of the password. A person may become married and need the full name in the comment field changed. You may need to change the groups that user is in, or the drive that a home directory resides on. The usermod command is the tool for these tasks. The usermod command is similar to the useradd command and even shares some of the same options. However, instead of adding new accounts, it enables you to change various details of existing accounts. When invoking the usermod command, you must provide account details to change followed by the login name of the account. Table 11-3 lists the available options for the usermod command. Table 11-3: usermod Options for Changing Existing Accounts Options Description -c comment Change the description field of the account. You can also use the chfn command for this. Replace comment with a name or other description of the user account, placing multiple words in quotes. -d home_dir Change the home directory of the account to the specified new location. If the -m option is included, copy the contents of the home directory as well. Replace home_dir with the full path to the new directory. -e expire_date Assign a new expiration date for the account, replacing expire_date with a date in MM/DD/YYYY format. -f inactivity Set the number of days after a password expires until the account is permanently disabled. Setting inactivity to 0 disables the account immediately after the password has expired. Setting it to -1 disables the option, which is the default behavior. -g group Change the primary group (as listed in the /etc/group file) that the user is in. Replace group with the name of the new group. -G grouplist Set the list of groups that user belongs to. Replace grouplist with a list of groups. -l login_name Change the login name of the account to the name supplied after the -l option. Replace login_name with the new name. This automatically change the name of the home directory; use the -d and -m options for that. -m This option is used only in conjunction with the -d option. It causes the contents of the user s home directory to be copied to the new directory. -o This option is used only in conjunction with the -u option. It removes the restriction that user IDs must be unique. -s shell
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.

Web design programs - In an office with only a few users,

December 11th, 2007

In an office with only a few users, you can probably get away with using your personal mailbox to send and receive support e-mails. In a larger office, however, you should create a separate mailbox reserved only for technical support issues. This has several advantages over the use of your personal mailbox: Support messages will not be confused with personal or other non-support-related messages. Multiple people can check the mailbox and share administrative responsibility without needing to read each other s personal e-mail. Support e-mail is easily redirected to another person s mailbox when you go on vacation. Your personal e-mail continues to go to your personal mailbox. One easy solution is to simply create a support e-mail alias that redirects messages to an actual mailbox or list of mailboxes. For example, suppose you wish to create a support alias that redistributes e-mail to the user accounts for support staff members Joe, Mary, and Bob. You would log in as root, edit the /etc/alias file, and add lines similar to the following: # Technical support mailing list support: joe, mary, bob After saving the file, you need to run the newaliases command to recompile the /etc/aliases file into a database format. Now your users can send e-mail to the support e-mail address, and the message is automatically routed to everyone on the list. When a member of the list responds to that message, he or she should use the “Reply To All” option so that the other support staff members also see the message. Otherwise, multiple people may attempt to solve the same problem, resulting in wasteful duplication of effort. You may also choose to create an actual support user account. The technical support staff would log in to this account to check messages and send replies. In this manner, all replies are stamped with the support login name and not the personal e-mail address of a staff member. Resetting a user s password A common (if not the most common) problem that your users will encounter is the inability to log in. The most common causes for this are: They have the Caps Lock key on. They have forgotten the password. The password has expired. If the Caps Lock key is not on, then you probably need to reset the individual s password. Looking up the password and telling it to the user is not an option. Red Hat Linux stores passwords in an encrypted format. Instead, use the passwd command to assign a new password to the user s account. Tell the user what that new password is (preferably in person), but then set the password to expire soon so that he or she must choose one (hopefully, a new one that is more easily remembered). Cross-Reference See Chapter 14 for advice on how to select good passwords.
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Web design service - one step further: Imagine a scenario in which

December 11th, 2007

one step further: Imagine a scenario in which the systems dexter, ratbert, and daffy all have portable desktops that are shared with the other systems. The /etc/fstab and /etc/exports files for each system should have the following lines added to them. The /etc/exports and /etc/fstab files for dexter are as follows: /etc/exports file /home/dexter ratbert,daffy /etc/fstab file Ratbert:/home/ratbert /home/ratbert nfs defaults 0 0 Daffy:/home/daffy /home/daffy nfs defaults 0 0 The /etc/exports and /etc/fstab files for ratbert are: /etc/exports /home/ratbert dexter,daffy /etc/fstab dexter:/home/dexter /home/dexter nfs defaults 0 0 daffy:/home/daffy /home/daffy nfs defaults 0 0 The /etc/exports and /etc/fstab files for daffy are: /etc/exports /home/dexter ratbert,dexter /etc/fstab Ratbert:/home/ratbert /home/ratbert nfs defaults 0 0 Dexter:/home/dexter /home/dexter nfs defaults 0 0 As you can see, each system uses NFS to mount the home directories from the other two systems. A user can travel from server to server and see exactly the same desktop on each system. Providing Support to Users Creating new user accounts is just one small administrative task among many. No single chapter can adequately discuss all the tasks that are involved in the ongoing support of users. But I share with you a few hints and procedures to ease that burden. Creating a technical support mailbox E-mail is a wonderful communication tool, especially for the overworked system administrator. In my experience, people put more thought and effort into their e-mail messages than into the voice messages that they leave. A text message can be edited for clarity before being sent, and important details can be cut and pasted from other sources. This makes e-mail an excellent method for Red Hat Linux users to communicate with their system administrator.
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Virtual web hosting - set prompt=’[%n@%m %c]$ ‘ else set prompt=[`id -nu`@`hostname

December 10th, 2007

set prompt=’[%n@%m %c]$ ‘ else set prompt=[`id -nu`@`hostname -s`]$ endif endif if ( -d /etc/profile.d ) then set nonomatch foreach i ( /etc/profile.d/*.csh ) if ( -r $i ) then source $i endif end unset i nonomatch endif The /etc/cshrc and /etc/bashrc files set a variety of shell environment options. If you wish to modify or add to the shell environment supplied to every single user on the system, the /etc/bashrc or /etc/cshrc files are the place to do it. Creating Portable Desktops Linux is an operating system that was born on the Internet, so it is not surprising that it has such strong networking capabilities. This makes Linux an excellent server, but it also allows Linux to be an excellent desktop workstation, especially in a highly networked environment. Red Hat Linux lets you easily set up your users with a portable desktop that follows them from computer to computer. With other leading desktop operating systems, it is not nearly as easy. Normally, a Red Hat Linux user s home directory is located within the /home directory. I suggest an alternative. Within the home directory, create a directory named after the system s hostname. Within that directory, create the users home directories. Thus, on a Linux system named dexter, the user mary would have a home directory of /home/dexter/mary instead of /home/mary. There is a very good reason for doing this. If you are logged into the Linux system ratbert and wish to access your home directory on dexter as if it were stored locally, the best approach is to use Network File System (NFS) to mount dexter s /home directory on the /home on ratbert. This results in having the same contents of your home directory available to you no matter which machine you log in to. Cross-Reference You can read more about NFS in Chapter 18. To mount dexter s /home directory as described, you would add a line similar to the following in ratbert s /etc/fstab file: dexter:/home /home nfs defaults 0 0 You would also add an entry similar to the following in dexter s /etc/exports directory: /home ratbert Now, when ratbert boots up, it automatically mounts dexter s home partition over the network. This enables us to treat the remote files and directories on dexter s /home as if they are locally stored on ratbert. Unfortunately, this has the side effect of “covering up” ratbert s actual /home directory. This is where the extra directory level based on the system name comes to the rescue. With all of dexter s home directories located in /home/dexter and all of ratbert s home directories located in /home/ratbert, we can remove the danger of one system covering up the home directories of another. In fact, let us take this example
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

Vps web hosting - Supplying an initial .tcshrc file This following example

December 10th, 2007

Supplying an initial .tcshrc file This following example .tcshrc file does basically the same thing as the preceding .bashrc example. However, this file (which is for the root user) has the additional task of setting the appearance of the command prompt: # .tcshrc # User specific aliases and functions alias rm rm -i alias cp cp -i alias mv mv -i setenv PATH “$PATH:/usr/bin:/usr/local/bin” set prompt= [%n@%m %c]# Instead of using the export command to set environment variables, the tcsh shell uses the setenv command. In the example, setenv is used to set the PATH variable. The shell prompt is set to include your user name (%n), your computer name (%m), and the name of the current directory (%c). So, if you were to use the tcsh shell as the root user on a computer named maple with /tmp as your current directory, your prompt would appear as follows: [root@maple /tmp]# The .tcshrc file can also be named .cshrc. The tcsh shell is really an extended version of the csh shell (in fact, you can invoke it by the csh name). When a tcsh shell is started, it first looks for a .tcshrc file in the current user s home directory. If it can t find a file by that name, it looks for the other name, .cshrc. Thus, either name is appropriate. Configuring systemwide shell options Allowing individually customizable shell startup files for each user is a very flexible and useful practice. But sometimes you need more centralized control than that. You may have an environment variable or other shell setting that you want set for every user, without exception. If you add that setting to each individual shell, the user has the ability to edit that file and remove it. Furthermore, if that setting must be changed in the future, you must change it in every single user s shell startup file. Fortunately, there is a better way. There are default startup files that apply to all users of the computer that each command shell reads before reading the user-specific files. In the case of the bash command shell, it reads the /etc/bashrc file before doing anything else. Similarly, the tcsh shell reads the /etc/csh.cshrc file before processing the .cshrc or .tcshrc file found in the user s home directory. The /etc/csh.cshrc file that ships with Red Hat Linux is as follows: # /etc/cshrc # # csh configuration for all shell invocations. # by default, we want this to get set. # Even for non-interactive, non-login shells. [ `id -gn` = `id -un` -a `id -u` -gt 99 ] if $status then umask 022 else umask 002 endif if ($?prompt) then if ($?tcsh) then
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.