@ system-tools
@ development-tools
@ text-internet
@ server-cfg
@ admin-tools
@ network-server
@ kernel-development
2、通過命令setup,設置系統運行必要服務
crond
network
xinetd
iptables
ssh
syslog
vi /etc/profile
PS1='${USER}:${PWD}>'
vi /etc/motd
HOSTNAME: vmware.host
IP : 192.168.1.123
MEM : 256M
CPU : Intel(R) Pentium(R) M processor 1600MHz
DISK : 250G
5、爲了方便管理用戶,加入用戶時將其加入同一個組。
root:/usr/local>groupadd admins
root:/usr/local>useradd -G admins fei
root:/usr/local>id fei
uid=580(fei) gid=580(fei) groups=580(fei),505(admins)
6、安裝sudo
tar zxvf bak/sudo-1.6.6.tar.gz
cd sudo-1.6.6/
./configure --help
./configure
make
make install (root)
/usr/local/sbin/visudo
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
User_Alias USERADMIN=shell,test,aian,lei 添加一行修改成需要的用戶
# Cmnd alias specification
Cmnd_Alias USERADMIN_COM=/usr/local/sbin/suroot 添加一行
# User privilege specification
root ALL=(ALL) ALL
USERADMIN ALL=USERADMIN_COM
注:在執行時使用sudo
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#MAIL=/bin/mail
w > /tmp/wcheck
/bin/mail -s "$HOSTNAME $USER Login `date +%m%d-%R`" [email][email protected][/email] </tmp/wcheck -- -f $USER@$HOSTNAME
unset USERNAME
# Functions and aliases go in /etc/bashrc
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
#setup JDK environment variable
JAVA_HOME=/home/jdk/jdk1.5.0_11
CLASSPATH=$JAVA_HOME/lib/tools.jar:JAVA_HOME/lib:JAVA_HOME/bin
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
PS1='${USER}:${PWD}>'
w > /tmp/wcheck
/bin/mail -s "$HOSTNAME $USER Login `date +%m%d-%R`" [email][email protected][/email] </tmp/wcheck
if [ -r "$i" ]; then
. $i
fi
done
unset pathmunge
fsck.ext2: Is a directory/:
………………
………………
………………
Give root password for maintenance
(or type Control-D to continue):
mv: cannot move '/etc/fstab.old' to '/etc/fstab': Read-only file system
Warning: can't open /etc/fstab: No such file or directory
(Repair filesystem) 3 #
(Repair filesystem) 5 #
# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
-o options 主要用來描述設備或檔案的掛接方式。常用的參數有:
loop:用來把一個文件當成硬盤分區掛接上系統
ro:採用只讀方式掛接設備
rw:採用讀寫方式掛接設備
iocharset:指定訪問文件系統所用字符集
# mount -t ext3 /dev/sda1 /mnt/sda1
# chroot /mnt/gentoo /bin/bash (切入硬盤Linux 系統) # env-update >>> Regenerating /etc/ld.so.cache... # source /etc/profile # export PS1="(chroot) $PS1"
# default value.
Port 45678 加入
#Port 22
#Protocol 2,1
Protocol 2
#AddressFamily any
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@localhost ~]#