⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unx36.htm

📁 Linux Unix揭密.高质量电子书籍.对学习Linux有大帮助,欢迎下载学习.
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<HTML>

<HEAD>

<TITLE>UNIX Unleashed unx36.htm</TITLE>

<LINK REL="ToC" HREF="index.htm">

<LINK REL="Next" HREF="unx37.htm">

<LINK REL="Previous" HREF="unx35.htm"></HEAD>

<BODY TEXT="#000000" LINK="#0000FF" VLINK="#800080" bgcolor=white>

<P><A HREF="unx35.htm"><IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>

<A HREF="index.htm"><IMG SRC="blutoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>

<A HREF="unx37.htm"><IMG SRC="blunext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>

<A HREF="index.htm"><IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Home"></A>

</P><UL>

<UL>

<LI>

<A HREF="#I1">36 &#151; User Administration</A></LI>

<UL>

<UL>

<UL>

<LI>

<A HREF="#I3">By Sydney S. Weinstein</A></LI></UL></UL>

<LI>

<A HREF="#I4">What Makes Up a User Account</A></LI>

<UL>

<LI>

<A HREF="#I5">The User's Home Directory</A></LI>

<LI>

<A HREF="#I6">The User's Mail File</A></LI>

<LI>

<A HREF="#I7">Mail Alias File Entries</A></LI>

<LI>

<A HREF="#I8">The Shell Start-up Files</A></LI>

<LI>

<A HREF="#I9">The User's passwd File Entry or NIS/NIS+ Database Entry</A></LI>

<UL>

<LI>

<A HREF="#I10">User Name</A></LI>

<LI>

<A HREF="#I11">Password (if Not Using a Shadow Password Scheme)</A></LI>

<LI>

<A HREF="#I12">User ID</A></LI>

<LI>

<A HREF="#I13">Default Group ID</A></LI>

<LI>

<A HREF="#I14">Full Name (GCOS Field)</A></LI>

<LI>

<A HREF="#I15">Initial Home Directory</A></LI>

<LI>

<A HREF="#I16">Shell</A></LI></UL>

<LI>

<A HREF="#I17">Shadow File Entry (NIS/NIS+ database entry)</A></LI>

<UL>

<LI>

<A HREF="#I18">User Name</A></LI>

<LI>

<A HREF="#I19">Password</A></LI>

<LI>

<A HREF="#I20">Password Last Changed Date</A></LI>

<LI>

<A HREF="#I21">Minimum Number of Days Between Password Changes</A></LI>

<LI>

<A HREF="#I22">Maximum Number of Days a Password Is Valid</A></LI>

<LI>

<A HREF="#I23">Number of Days to Warn User to Change passwd</A></LI>

<LI>

<A HREF="#I24">Number of Days the Login May Be Inactive</A></LI>

<LI>

<A HREF="#I25">Date When the Login Is No Longer Valid</A></LI></UL>

<LI>

<A HREF="#I26">The /etc/group File</A></LI></UL>

<LI>

<A HREF="#I27">Building the Skeleton</A></LI>

<UL>

<LI>

<A HREF="#I28">Creating Skeleton Shell Files</A></LI>

<LI>

<A HREF="#I29">Additional Files You May Wish to Create</A></LI></UL>

<LI>

<A HREF="#I30">Adding a User</A></LI>

<UL>

<LI>

<A HREF="#I31">Before Adding the User</A></LI>

<LI>

<A HREF="#I32">Running useradd</A></LI>

<LI>

<A HREF="#I33">Creating Mail Alias Entries</A></LI>

<LI>

<A HREF="#I34">NIS Effects</A></LI></UL>

<LI>

<A HREF="#I35">Removing a User</A></LI>

<UL>

<LI>

<A HREF="#I36">Disabling the User's Login</A></LI>

<LI>

<A HREF="#I37">Cleaning Up Disk Space Assigned to This User</A></LI>

<LI>

<A HREF="#I38">Final User Removal After All Files Are Handled</A></LI></UL>

<LI>

<A HREF="#I39">Summary</A></LI></UL></UL></UL>



<H2 ALIGN="CENTER">

<CENTER><A ID="I1" NAME="I1">

<FONT SIZE=5><A ID="I2" NAME="I2"></A><B>36 &#151; User Administration</B>

<BR></FONT></A></CENTER></H2>

<H5 ALIGN="CENTER">

<CENTER><A ID="I3" NAME="I3">

<FONT SIZE=3><B>By Sydney S. Weinstein</B>

<BR></FONT></A></CENTER></H5>

<P>Although users may be the reason for the existence of your UNIX system, they also can be the sysadmin's worst nightmare. Users are always making demands and changing things. The one thing that remains constant is that users come and go, but the system 
remains.

<BR></P>

<P>As system administrator, you will have to add and remove users from the system. It is also your task to provide the default environment so users can get their jobs done. This chapter shows what makes up a user's account, how to create new user accounts, 

and what to do when a user leaves and his account must be removed.

<BR></P>

<H3 ALIGN="CENTER">

<CENTER><A ID="I4" NAME="I4">

<FONT SIZE=4><B>What Makes Up a User Account</B>

<BR></FONT></A></CENTER></H3>

<P>Users see UNIX as a home directory and a shell. Behind the scenes are many other files and parameters that affect the user. This section explains each part of the user's account and how it affects the user.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I5" NAME="I5">

<FONT SIZE=3><B>The User's Home Directory</B>

<BR></FONT></A></CENTER></H4>

<P>Every process in UNIX has a current directory. This is no different for the login shell for a user. The initial current directory for a login shell is called its home directory. The login program sets the HOME environment variable to the full pathname 
to this directory. It is in this directory that the login shell looks for its start-up files. It is also in this directory that system daemons look for the following:

<BR></P>

<UL>

<LI>.Xauthority&#151;the processes that are allowed to access the X screen being used by this user.

<BR>

<BR></LI>

<LI>.Xdefaults&#151;X programs keep default values for their options in this file.

<BR>

<BR></LI>

<LI>.cshrc&#151;csh/tcsh start-up script.

<BR>

<BR></LI>

<LI>.exrc&#151;vi/ex start-up script.

<BR>

<BR></LI>

<LI>.forward&#151;mail redirection file. In this file you place the address or addresses to forward your mail. It allows you to receive mail from many accounts on a single account, or to pass your mail through a program to filter it before reading it.

<BR>

<BR></LI>

<LI>.history&#151;holds the last set of commands you executed in the shell for use in the history shell command.

<BR>

<BR></LI>

<LI>.ksh_env&#151;ksh start-up script.

<BR>

<BR></LI>

<LI>.login&#151;csh login script, which is executed once at login after .cshrc.

<BR>

<BR></LI>

<LI>.mailrc&#151;mail start-up script.

<BR>

<BR></LI>

<LI>.mwmrc&#151;motif window manager start-up script.

<BR>

<BR></LI>

<LI>.openwin-init&#151;openlook window manager start-up script.

<BR>

<BR></LI>

<LI>.openwin-menu&#151;openlook window manager root menu.

<BR>

<BR></LI>

<LI>.profile&#151;sh/ksh login script, which is executed once at login, after /etc/profile.

<BR>

<BR></LI>

<LI>.rhosts&#151;the remote hosts and users that are equivalent to this user. Equivalent means can log in as this user from a remote system without specifying a password and can access files and perform commands as this user on this system without being 
challenged for a password. (Used by the networking commands rsh, rexec, rcp, and rlogin.)

<BR>

<BR></LI>

<LI>.xinitrc&#151;X start-up file.

<BR>

<BR></LI>

<LI>.xmodmaprc&#151;X keyboard remapping file.

<BR>

<BR></LI></UL>

<P>Many other programs also look for special start-up files in the user's home directory.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I6" NAME="I6">

<FONT SIZE=3><B>The User's Mail File</B>

<BR></FONT></A></CENTER></H4>

<P>Each user on a UNIX system is eligible to receive electronic mail. Normally, this file is in one of these systemwide spool directories:

<BR></P>

<UL>

<LI>/var/mail&#151;System V&#151;derived systems (obsolete name /usr/mail)

<BR>

<BR></LI>

<LI>/var/spool/mail&#151;Berkeley-derived systems (obsolete name /usr/spool/mail)

<BR>

<BR></LI></UL>

<P>Some systems now place this mail file in the user's home directory. No matter where it's located, this file will hold the mail this user has yet to read, delete, or move into other folders.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I7" NAME="I7">

<FONT SIZE=3><B>Mail Alias File Entries</B>

<BR></FONT></A></CENTER></H4>

<P>In addition to the mail file, the user name might be listed in the systemwide mail alias file. This file resides in one of several places:

<BR></P>

<UL>

<LI>/etc/aliases

<BR>

<BR></LI>

<LI>/etc/mail/aliases

<BR>

<BR></LI>

<LI>/usr/lib/aliases

<BR>

<BR></LI>

<LI>/usr/lib/mail/aliases

<BR>

<BR></LI></UL>

<P>Regardless of where the alias file resides, it consists of lines containing the alias and the mail address to use for mail received for that alias. Aliases are checked before local user names when mail is being delivered, so you can even alias a local 
user name to a different machine or user. Listing 36.1 is a small excerpt from a mail alias file. It has the required postmaster alias and some local aliases.

<BR></P>

<UL>

<LH><B>Listing 36.1. Excerpt from a sample mail alias file.</B></LH></UL>

<PRE>## 

#  Aliases can have any mix of upper and lower case on the 

#    left-hand side,     but the right-hand side should be proper

#    case (usually lower)

#

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -