📄 yolinux tutorial linux system configuration and administration.mht
字号:
export and restrictions. <BR>For more see <A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dexports"=
>exports=20
man page</A>. </TD></TR></TBODY></TABLE><BR>Pitfalls:=20
<UL>
<LI>Server must run services: <TT>portmap, nfslock, netfs, =
nfs</TT>=20
<LI>Restart server service to pick up file changes: =
<TT>service nfs=20
restart</TT> <BR>(or: <TT>/etc/init.d/nfs restart</TT>)=20
<LI>Iptables may block port. Clear iptables rules with =
<TT>iptables=20
-F</TT> to test. Keep ports 111 and 2049 clear.=20
<LI>Check PAM restrictions in <TT>/etc/hosts.deny</TT> and=20
<TT>hosts.allow</TT>.=20
<LI>To avoid NFS hanging up the system and immunity from the =
kill=20
command, use the "intr" option to allow the process to be =
interrupted.=20
<LI>The user id (uid) numbers and the group id (gid) numbers =
on both=20
systems MUST match to preserve sanity. Check the numbers used =
in=20
<TT>/etc/passwd</TT> and <TT>/etc/group</TT>. Typically this =
problem=20
is solved by using a single point of authentication. Use NIS =
or LDAP.=20
<LI>NEVER EVER mount to a user's home directory. i.e.=20
<TT>/home/<I>user1</I>/<I>mount-point</I></TT> <BR>This is =
because=20
when the user is removed from the system with the command =
<TT>userdel=20
-r <I>user1</I></TT>, the user's home directory is wiped and =
all=20
subdirectories including the path below the mount point will =
be=20
erased!! </LI></UL><BR>NFS Man pages:=20
<UL>
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dnfs">nfs=
</A>=20
- fstab format and options=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dexports"=
>exports</A>=20
- NFS file systems being exported (for Kernel based NFS)=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dexportfs=
">exportfs</A>=20
- maintain list of NFS exported file systems=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Drpc.nfsd=
">nfsd/rpc.nfsd</A>=20
- NFS server process=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dnfsstat"=
>nfsstat</A>=20
- print NFS statistics=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Drpc.moun=
td">rpc.mountd</A>=20
- NFS mount daemon </LI></UL>
<P>NFS GUI Configuration tool:=20
<UL>
<LI><B><TT>system-config-nfs</TT></B> (Fedora Core 2+, RHEL4)=20
<LI><B><TT>redhat-config-nfs</TT></B> (Fedora Core 1) =
</LI></UL></LI></UL>
<P><A name=3DUSERS></A>
<P>
<HR SIZE=3D5>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>User Info:</BIG></B></TD></TR></TBODY></TABLE>
<P><B>Commands:</B>=20
<DL>
<DD>
<TABLE>
<TBODY>
<TR>
<TD vAlign=3Dtop><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dwho">who=
</A>=20
</TD>
<TD>Displays currently logged in users. <BR>Use <TT>who =
-uH</TT>=20
for idle time and terminal info.</TD></TR>
<TR>
<TD vAlign=3Dtop><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dusers">u=
sers</A>=20
</TD>
<TD>Show all users logged in. </TD></TR>
<TR>
<TD vAlign=3Dtop><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dw">w</A>=
=20
</TD>
<TD>Displays currently logged in users and processes they =
are=20
running. </TD></TR>
<TR>
<TD vAlign=3Dtop><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dwhoami">=
whoami</A>=20
</TD>
<TD>Displays user id.</TD></TR>
<TR>
<TD vAlign=3Dtop><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dgroups">=
groups</A>=20
</TD>
<TD>Display groups you are part of.<BR>Use <TT>groups=20
<I><B>user-id</B></I></TT> to display groups for a given =
user.=20
</TD></TR>
<TR>
<TD vAlign=3Dtop><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dset">set=
</A>=20
</TD>
<TD>Display all environment variables in your current =
environment.=20
</TD></TR>
<TR>
<TD vAlign=3Dtop><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Did">id</=
A>=20
</TD>
<TD>Display user and all group ids. <BR>Use <TT>id=20
<I><B>user-id</B></I></TT> to display info for another =
user=20
id.</TD></TR>
<TR>
<TD vAlign=3Dtop><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dlast">la=
st</A>=20
</TD>
<TD>Listing of most recent logins by users. Show where from, =
date=20
and time of login (ftp, ssh, ...) Also see <TT><A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LinuxTutorialSysAdmin.html#LOGFI=
LES">lastlog</A></TT>=20
command.<BR>Show last 100 logins: <TT>last =
-100</TT></TD></TR>
<TR>
<TD vAlign=3Dtop><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dhistory"=
>history</A>=20
</TD>
<TD>Shell command to display previously entered commands.=20
</TD></TR></TBODY></TABLE></DD></DL>
<P><A name=3DUSERGREETINGS></A>
<P>
<HR SIZE=3D5>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>User =
Greetings:</BIG></B></TD></TR></TBODY></TABLE>
<P>The greeting messages and login displays are all customizable.=20
<DL>
<DD>
<TABLE border=3D1>
<TBODY>
<TR bgColor=3D#c0c0c0>
<TH>Type of greeting</TH>
<TH>File</TH></TR>
<TR>
<TD vAlign=3Dtop>Telnet pre-login Text: </TD>
<TD vAlign=3Dtop>File containing text: <TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dissue(5)=
">/etc/issue</A></TT></TD></TR>
<TR>
<TD vAlign=3Dtop>Ssh pre-login Text: </TD>
<TD vAlign=3Dtop><TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dsshd_con=
fig">/etc/ssh/sshd_config</A></TT><BR>Specify=20
text file: <TT>Banner /etc/issue</TT></TD></TR>
<TR>
<TD vAlign=3Dtop>vsftpd Login Text: </TD>
<TD vAlign=3Dtop>vsftpd config file: <TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dvsftpd">=
/etc/vsftpd/vsftpd.conf</A></TT><BR>Set=20
text greeting: <TT>ftpd_banner=3D<I>Put welcome greeting=20
here</I></TT></TD></TR>
<TR>
<TD vAlign=3Dtop>Post login text message: <BR>(message of =
the=20
day)</TD>
<TD vAlign=3Dtop><TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dmotd">/e=
tc/motd</A></TT><BR>Default=20
is blank.</TD></TR>
<TR>
<TD vAlign=3Dtop>GDM graphical login display: </TD>
<TD vAlign=3Dtop><TT>/etc/X11/gdm/gdm.conf</TT> (or=20
<TT>/etc/gdm/gdm.conf</TT>)<BR>Set image:=20
<TT>DefaultFace=3D<I>/path/file.png</I></TT><BR>Set logo:=20
<TT>Logo=3D<I>/path/file.png</I></TT><BR>Set background:=20
=
<TT>BackgroundImage=3D<I>/path/file.png</I></TT></TD></TR></TBODY></TABLE=
></DD></DL>
<P><A name=3DNEWUSERS></A>
<P>
<HR SIZE=3D5>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Creating a new system local user=20
account:</BIG></B></TD></TR></TBODY></TABLE>
<P>The three most common methods of defining a Linux user and=20
authenticating their logins are:=20
<OL>
<LI>Local user authenticated locally with the password files =
<TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dpasswd&a=
mp;cgi_section=3D5">/etc/passwd</A></TT>=20
and <TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dshadow&a=
mp;cgi_section=3D5">/etc/shadow</A></TT>=20
<LI>Network authentication using an <A=20
=
href=3D"http://www.yolinux.com/TUTORIALS/LDAP_Authentication.html">LDAP=20
authentication server</A>=20
<LI>NIS authentication server. To specify an NIS authentication =
server,=20
use <TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dypconf">=
/etc/ypconf</A></TT>=20
which contains the line: <TT>ypserver =
<I>ip.address.of.server</I></TT>.=20
Find with <TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dypwhich"=
>ypwhich</A></TT>=20
</LI></OL>
<P>The following describes creating a local user:=20
<P>
<UL>
<LI><B>Command Line Method:</B> (My preference) <BR>
<UL>
<LI><TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Duseradd"=
>useradd</A>=20
<USER name></TT>: Add a user to the system.=20
<LI><TT>useradd -m <USER name></TT>: Add a user to the system =
and=20
create a home directory populated with the default files from=20
<TT>/etc/skel/</TT>=20
<LI><TT>useradd -m <USER name>-G floppy</TT> : Will grant the =
user=20
read/write privileges to the floppy (/dev/fd0) upon creation =
of user=20
by adding user to group floppy.=20
<LI><TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Duserdel"=
>userdel</A>=20
<USER name></TT>: Delete user from system. Purges user from=20
/etc/passwd, group and shadow files=20
<LI><TT>userdel -r <USER name></TT>: Delete user and remove =
his home=20
directory from the system. Other files will remain. <BR><FONT=20
color=3D#ff0000>[Potential Pitfall]</FONT>: Use the command=20
"<TT>df</TT>" to see if there are any mount points to the =
user's=20
directory. If there are any, they will get wiped out with the=20
recursive delete. Thus as a policy it is best to NEVER =
generate a=20
mount point within a user's directory. It is best to mount to=20
<TT>/mnt/<I>mount-dir</I></TT> and use a sym-link (<TT>ln -s=20
/mnt/<I>mount-dir</I>=20
/home/<I>user-name</I>/<I>mount-dir-local</I></TT>) to the =
user's=20
directory. The default is to not follow symlinks during the =
delete.=20
<LI><TT><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dpasswd">=
passwd</A>=20
<USER name></TT>: Assign a password to the user. (Also see <A=20
href=3D"http://sourceforge.net/projects/pwgen/">pwgen</A>, a =
password=20
generator) </LI></UL>
<P>Also see man page for: <A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dusermod"=
>usermod</A>.=20
<BR>Configuration file for useradd command:=20
<TT>/etc/default/useradd</TT>=20
<P>Default directory configuration and files for a new user are =
copied=20
from the directory <TT>/etc/skel/</TT>. The default shell is =
called bash=20
(bsh) and is a cross of the UNIX ksh and csh command shells. The =
users=20
personal bash shell customizations are held in $HOME/.bashrc.=20
<P></P>
<LI><B>GUI Method:</B>=20
<UL>
<LI><B>system-config-users</B>: GUI admin tool for managing =
users and=20
groups. (Fedora Core 2+, RHEL4)=20
<LI><B>redhat-config-users</B>: GUI admin tool for managing =
users and=20
groups. (Fedora Core 1)=20
<LI><B>linuxconf</B>: (Note: Linuxconf is no longer included =
with Red=20
Hat Linux 7.3+)=20
<UL>
<LI>Start linuxconf:=20
<UL>
<LI>RH 5.2: Select Start + Programs + Administration + =
linuxconf .=20
<LI>RH 6+: Select Gnome Start icon (located lower left =
corner) +=20
System + Linuxconf . </LI></UL>
<LI>Add the user: Select options Config + User accounts =
+Normal +=20
User accounts + select button Add . There is also the option =
of=20
adding the user to additional groups. (I.e enter floppy =
under the=20
heading Supplementary groups and then Accept ) For a list of =
groups,=20
the group names should be separated by a simple space. This =
tool=20
will allow you to set default directories, shells, add rules =
about=20
passwords, set e-mail aliases, group membership and
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -