1.CentOS 配置 NIS 步骤

服务器:

1. 安装软件包

yum -y install ypserv

2. 设置 NIS 域

nisdomainname test.com

3. 修改 ypserv.conf

# *                        : *       : *                : none

改为

*                        : *       : *                : none

4. 建立测试账号

useradd -m test1

passwd test1

5. 启动服务

# service ypserv restart  // 每次建立用户后,先要到 /var/yp 里面 make 一下,然后重启此服务

# service yppasswdd restart //client 可以修改密码

# service portmap restart

# rpcinfo -p localhost  // 检查本机 rpc 情况

6. 设置 NIS Server 开机自动运行

chkconfig ypserv on

chkconfig yppasswdd on

chkconfig portmap on

7. 建立资料库

ypinit -m

CTRL+D 键完成设置

8. 测试服务器

ypcat -h localhost passwd.byname

客户端

1. 安装软件

yum -y install ypbind

yum -y install yp-tools

yum -y install portmap

2. 设置 NIS 域

nisdomainname test.com

3. 设置 /etc/sysconfig/network

增加一行

NISDOMAIN test.com

4. 修改 /etc/yp.conf

增加

ypserver server // 其中 server 是服务器对应的主机名

5. 修改 /etc/nsswitch.conf

shadow files

passwd files

group files

修改为

shadow files nis

passwd files nis

group files nis

6. 重启服务

#/etc/init.d/portmap start

#/etc/init.d/ypbind start

7. 测试客户端

#ypcat passwd

#finger test1

nis server 排除问题的方法

在服务器和客户端上分别运行。

rpcinfo -p localhost

rpcinfo -p localhost portmap

rpcinfo -u /-t localhost ypserv

客户端调试运行

ypbind -d -v

参考:

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch30_:_Configuring_NIS

2.Samba 配置

变量

说明

客户端变量

%a

客户端体系:

比如 : Win95, WfWg, WinNT, Samba ...

%I

客户端 IP 地址

%m

客户端 NetBios 名

%M

客户端 DNS 名

用户变量

%g

用户 %u 主要组

%H

用户 %u home 目录

%u

Unix 当前用户名

共享变量

%P

当前共享的根目录

%S

当前的共享名

服务器变量

%h

Samba 服务器的 DNS 名字

%L

Samba 服务器的 Netbios 名字

%v

Samba 版本

其他变量

%T

当前日期和时间

对于“新手们”的重要说明!

# 使用 mksmbpasswd 生成的 smbpasswd 文件需要用 smbpasswd -U 方式重新设定新密码!

# windows 访问无效应该用 iptables -F 暂时关闭防火墙 ( 等你学会使用 iptables 后再开启此功能 )

[global]

# workgroup = NT-Domain-Name o Workgroup-Name ,比如: THEDOMAIN

# PDC 域

# workgroup = THEDOMAIN

# 在其他的机器中声明的本机器的名称

# netbios name = SMBServer

# 这个声明会出现在 Windows 的 " 网络邻居 " 中

# server string = Samba Server de este lugar

# 这一行由于安全的原因很关键,只许在局域网中特定的计算机的连接。

# 在这个例子中,是 192.168.8.0 ( C 级网络)的网络

# 和 " 环路 "(loopback) 的接口是可以连接的。

# 更多的细节,请阅读 smb.conf man 手册。

# 比如:只有从规定开始的 ip 以后的地址才能共享资源。

# 192.168.8 和 127 ( 以后的注释 )

# hosts allow = 192.168.8. 127.

# 如果你想自动载入一个打印机的清单,这样就不必一个一个手动录入,可以使用:

# load printers = yes

# 覆盖 printcap 的路径是可能的。

# printcap name = /etc/printcap

# 在 SystemV 系统中 printcap 对 lpstat 名称属性一定允许

# 自动地从 SystemV (这么个词! :-) )的 spool 系统中取得打印机列表。

# printcap name = lpstat

# 如果打印机系统是非标准的,就需要指定是什么打印系统。

# 现在支持的打印系统有:

# bsd, sysv, plp, lprng, aix, hpux, qnx

# printing = bsd

# 如果你需要一个 guest 帐户,你不要注释掉下面这行。

# 你一定么加入这条到 /etc/passwd 里,否则这个用户无 " 人 " 可用。

# guest account = pcguest

# 下面这条就是使得每台计算机都有一个不同的 log 文件,

# 通过这个文件和 SAMBA 服务器相连。

# log file = /var/log/samba/log.%m

# 设置 log 文件长度的限制(单位 Kb) 。

# max log size = 50

# 阅读 security_level.txt for 得到更多的细节

# 指定验证密码的方式

# 用户级的安全策略=每个用户都有自己的密码 ( SAMBA 密码)

# security = user

# 如果使用服务器级的安全策略,验证过程在另一个机器上进行。

# 只有在使用服务器级的安全策略时,才使用值 "password server"

# 密码服务器等于【认证服务器地址】。

# password server =

# 如果你想使用加密的密码,请阅读 Samba 文档中的 ENCRYPTION.TXT ,

# Win95.txt 和 WinNT.txt 。

# 你只有清楚的了解这个属性的足够多的信息才能使用它。

# 信息: Win95 , Win98 和 WinNT 可以发送加密的密码。

# encrypt passwords = yes

# 使用下列的行来定制你的配置。

# 在网络中的每个计算机, %m 取代了自身 netbios 的名字。

# include = /usr/local/samba/lib/smb.conf.%m

# 在你会发现文档和一些流行的 " 提示 " 会告诉你下面的选项可以得到更好的性能。

# 试试!

# 阅读 speed.txt 和手册来知道更多的细节。

# socket options = TCP_NODELAY

# Samba 可以配置多种的网络接口。

# 如果你使用多种网络接口,你一定要在下面列出来。

# 阅读手册来知道更多的细节。

# interfaces = 192.168.8.2/24 192.168.12.2/24

# Browser 控制选项:

# 如果你不想让 samba 做为网络中的主 browser , 设置 "local master = no" 。

# local master = yes

# 在 OS 水平上,本服务器当选主 browser 优先权的设置。

# 一般地,缺省值可能就可以了。

# os level = 33

# 域主机指定 Samba 成为域中主 Browser 。

# 这样允许 Samba 运行域控制器和在不同的 TCP/IP 子网中能被 " 看成 " 一台机器。

# 如果你使用了 Windows NT/2000 域控制器,你就不应该使用它。

# domain master = yes

# 更高级的域主在启动中使得 Samba 成为一个局域的 Browser ,

# 这使得它有更多的机会(选举成为域主)。

# 如果我们有 2 个以上的服务器,级别高的服务器会更受 " 欢迎 " ,

# 客户机会在一个列表中搜寻到一台服务器的。

# preferred master = yes

# 只有你使用 NT/2000 服务器在以一个主域控制器 (PDC) 在运行,你才能使用下条。

* domain controller =

# 如果你想把 SAMBA 当成 Windows 9x/Me 工作站的 " 域登陆服务器 " ,你要使用下条。

# domain logons = yes

# 如果你使用了 " 域登陆 " ,你一定要使用一个登陆脚本,

# 在 Windows 网络中的每台机器或者每个用户。

# 每个工作站的特定登陆批处理是

# logon script = %m.bat

# 每个用户的特定登陆批处理是

# logon script = %U.bat

# 那里存放零星的 profiles 文件 ( 只对 Win95 和 WinNT 有效 )

# %L 取代这个服务器的 NetBIOS 名字, %U 取代用户名

# 如果你使用它,一定不要注释掉下面的 Profiles 共享

# logon path = /%LProfiles/%U

# Windows 互联网解析服务器:

# WINS 支持 - 告知 NMBD 使能它的 WINS 服务器。

# WINS 协议 把机器名转换成 IP 地址,

# 它象 TCP/IP 中 DNS 那样工作。

# wins support = yes

# WINS 服务器-告知 Samba 的 NMBD 部件成为 WINS 的一个客户。

# SAMBA 服务器可以成为其中的一个: WINS 服务器或 WINS 客户机,

# 但是不可以同时 2 者皆是。

# 这里 WINS IP 服务器一定要指定。

# wins server = 192.168.8.1

# WINS 代理-告知 Samba 回应那些没有 WINS 能力的客户的名字解析的请求,

# 这个情况只有在网络中至少有一台 WINS 服务器时才有效。

# 缺省是不。

# wins proxy = yes

# DNS 代理-告知 Samba 是否解析 NetBIOS 名字

# 版本 1.9.17 内建的缺省是 " 是 ", 从版本 1.9.18 变成了 " 否 "

# 这里我们可以告知 SAMBA 名字解析使用 DNS 或者不。

# dns proxy = yes

# dns proxy = no (name resolution will be made by using the file lmhosts )

# 如果登陆的驱动盘没有被指定, Z :单元会自动登陆的。

# logon drive = P:

# 当一个登陆出现时,这个脚本被执行: /etc/samba/netlogon/SAMBA.BAT

# 并且使用 "netuse" 来登陆磁盘单元

# logon script = SAMBA.BAT

# 每个用户的私人目录

# 单位 P :

# 中文显示配置

#linux 系统采用的字符集

unix charset

= cp936

#windows 系统采用的字符集

dos  charset

= cp936

# 向现实部分输出的字符集

display

charset

= cp936

[homes]

comment = Home Directories

browseable = no

writable = yes

readonly = no

force create mode = 0700

create mode = 0700

force directory mode = 0700

directory mode = 700

# 临时文件目录

# 单位 T:

[tmp]

comment = Tempora Files

path = /tmp

readonly = no

public = yes

writable = yes

force create mode = 0777

create mode = 0777

force directory mode = 0777

directory mode = 0777

# 服务器的 CD-ROM

# 单位 L:

[cdrom]

comment = CD-ROM

path = /mnt/cdrom

public = yes

writable = no

# 组,根据 /home/grp.name_group 来的

# /home/user/group 是 /home/grp.name_group 一个链接

# grp.name_group 使用权限 770

# 单位 G :

[group]

comment = Directory of Group

path = /home/%u/group

writable = yes

readonly = no

force create mode = 0770

create mode = 0770

force directory mode = 0770

directory mode = 0770

# 这个单元存放应用软件,安装软件,专用软件等。

# /net 和 /net/install 的权限是 755, 比如这里, root 是它的拥有者

# 单位 N :

[net]

comment = Directory Net

path = /net

writable = yes

readonly = no

force create mode = 0750

create mode = 0750

force directory mode = 0750

directory mode = 0750

[netlogon]

comment = Logon Services in the Network

path = /etc/samba/netlogon

guest ok = yes

writable = no

locking = no

public = no

browseable = yes

share modes = no

[install]

comment = install

path = /install

writable = no

readonly = yes

browseable = yes

guest ok = yes

# 强制以 root 身份

force user = root

force group = root

3 :ntp 服务器配置

NTP 服务的配置文件包括四个文件

/etc/ntp.conf

主要的配置文件

/usr/share/zoneinfo

规定各主要时区设定文件 , 例如中国大陆的时区设置文件是 /usr/share/zoneinfo/Asia/Shanhai

/etc/sysconfig/clock

Linux 的主要时区设定文件 , 每次启动后 Linux 操作系统就会自动读取这个文件来设定系统预设要显示的时间。

如这个文件内容为 "ZONE=Asia/Shanghai" 就表示 Linux 操作系统的时间设定使用

/usr/share/zoneinfo/Asia/Shanhai 这个文件。

/etc/localtime

本地系统的时间设定文件,如果 clock 文件里面规定了使用的时间设定文件为 /usr/share/zoneinfo/Asia/Shanghai,

Linux 操作系统就会将 Shanghai 那个文件复制或链接到 /etc/localtime ,所以系统的时间显示就会以 Shanghai 那个

设定文件为准

NTP 服务的主要命令

/bin/date

显示系统时间

/sbin/hwclock

同步 BIOS 时间与 Linux 系统时间

/usr/sbin/ntpd

NTP 服务的守护进程文件,需要启动它才能提供 NTP 服务

/usr/sbin/ntpdate

NTP 客户端用来连接 NTP 服务器命令文件

/usr/sbin/ntpq

标准的网络计时协议 (NTP) 查询程序。

/usr/sbin/ntptrace

跟踪网络计时协议主机链到他们的控制时间源

/sbin/clock

调整 RTC 时间。 RTC 是电脑内建的硬件时间,执行这项指令可以显示现在时刻

调整硬件时钟的时间,将系统时间设成与硬件时钟之时间一致,或是把系统时间回存到硬件时钟。

NTP 服务的配置文件 ntp.conf 参数

权限的设定主要以 restrict 这个参数来设定,格式如下:

restrict IP 地址 mask 子网掩码 参数

其中 IP 可以是 IP 地址,也可以是 default , default 就是指所有的 IP

参数有以下几个:

ignore  :关闭所有的 NTP 联机服务

nomodify :客户端不能更改服务端的时间参数,但是客户端可以通过服务端进行网络校时。

notrust :客户端除非通过认证,否则该客户端来源将被视为不信任子网

noquery :不提供客户端的时间查询

注意:如果参数没有设定,那就表示该 IP ( 或子网 ) 没有任何限制。

用 server 这个参数设定上级时间服务器,格式如下:

server IP 地址或域名 [prefer]

IP 地址或域名就是我们指定的上级时间服务器,如果 Server 参数最后加上 prefer ,表示我们的 NTP 服务器主要以该部主机时间进行校准。

driftfile 格式如下 :

driftfile 文件名

在与上级时间服务器联系时所花费的时间,记录在 driftfile 参数后面的文件内。

注意 : driftfile 后面接的文件需要使用完整的路径文件名,不能是链接文件,并且文件的权限需要设定成 ntpd 守护进程可以写入。

配置文件实例

# Permit time synchronization with our time source, but do not

# permit the source to query or modify the service on this system.

restrict default kod nomodify notrap nopeer noquery

restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could

# be tightened as well, but to do so would effect some of

# the administrative functions.

restrict 127.127.1.0

# Hosts on local network are less restricted.

restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap

restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap noquery notrust

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

server 0.pool.ntp.org

server 1.pool.ntp.org

server 2.pool.ntp.org

# Undisciplined Local Clock. This is a fake driver intended for backup

# and when no outside source of synchronized time is available.

server 127.127.1.0

fudge 127.127.1.0  stratum 10

# Drift file.  Put this in a directory which the daemon can write to.

# No symbolic links allowed, either, since the daemon updates the file

# by creating a temporary in the same directory and then rename()'ing

restrict 0.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery

restrict 1.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery

restrict 1.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery

# it to the file.

driftfile /etc/ntp.drift

# Key file containing the keys and key identifiers used when operating

# with symmetric key cryptography.

keys /etc/ntp-keys

# Specify the key identifiers which are trusted.

#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.

#requestkey 8

Logfile /var/log/ntp.log

# Specify the key identifier to use with the ntpq utility.

#controlkey 8

启动 NTPD

为了使 NTP 服务可以在系统引导的时候自动启动,执行:

#chkconfig ntpd on

启动 ntpd :

   service ntpd start

NTP 客户端配置:

在客户端手动执行“ ntpdate 服务器 IP ”来同步时间;

另可以使用 crond 来定时同步时间:

以 root 身份运行周期性任务:

crontab -e

添加以下内容,每 15 分钟更新一下时间:

15 * * * * ntpdate 服务器 IP

检查时间服务器是否正确同步

使用下面的命令检查时间服务器同步的状态:

#ntpq -p

一个可以证明同步有问题的证据是:所有远程服务器的 jitter 值是 4000 并且 delay 和 reach 的值是 0 。

可能的原因有:

有防火墙阻断了与 server 之间的通讯,即 123 端口是否正常开放;

此外每次重启 NTP 服务器之后大约要 3 - 5 分钟客户端才能与 server 建立正常的通讯连接,否则你在客户端执行“ ntpdate 服务器 ip ”的时候将返回:

27 Jun 10:20:17 ntpdate[21920]: no server suitable for synchronization found

4:安装mailserver时的遇到的一些问题解决办法

Suse Linux 软件库被占用的强制结束办法

1 、查找文件 /var/run/ for stale yast.pid or zypp.pid.

2 、从 pid 文件中得到进程号,用 kill 命令杀掉。

Mysql 数据库的一些简单操作

删除某个用户

use mysql;

delete from user where user="postfix" and host="localhost";

给用户某个数据库的所有权限

grant all privileges on postfix.* to postfixadmin@localhost identified by 'postfixadmin';

flush privileges;

列出数据库

Show dabases;

使用数据库

use databsename

列出数据库所有选项

show tables

新建一个用户,并给权限

grant all on *.* to postfix@"localhost" identified by "123";

apache2 的错误

(You don't have permission to access / on this server. )解决方法

1.root 用户

2. 权限要为 755 ,

3. 查找下面的红色部分,把它给去掉。

< Directory / >

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

< /Directory >

5:Stale NFS file handle的解决方法

用df -k察看磁盘使用情况时,一台机器报如下错误: Stale NFS file handle。

当我们已mount 上的file or directory ,在server上突然被remove or unexport ,就会出现此讯息“。

就是说,假如client端mount上了server端的directory之后,假如server端又将这个directory unshare了,那么就会在client端出现这个错误。

解决办法很简单,就是在client上把那个文档unmount掉。
可是其实做起来很难,因为经常会得到 is busy的错误。

能够用下面的三个方法:
1)用fuser杀掉占用那个目录的进程
fuser -k /directory

2)在启动的进程里面查找
ps -ef |awk '{print }' |grep -v PID |xargs /usr/proc/bin/pwdx

这种方法只能在solaris8及以上版本使用

3)umount -f /directory
强制umount

上面的1跟2方法有时候并不能解决问题,能够这三个一起结合着使用。

6:Redhat 关闭Selinux的方法

Redhat系统,修改/etc/sysconfig/selinux文件:
#SELINUX=enforcing
SELINUX=disabled

重启生效,如果不想重启,用命令
setenforce 0

SUSE Linux维护笔记三相关推荐

  1. SUSE Linux 维护笔记一

    SUSE Linux 维护笔记 一       (部分地址失效:要脚本的请留言) 1. Linux时间更新设置 时区设定: #主要文件 /etc/sysconfig/clock #用北京时间的正确内容 ...

  2. SUSE Linux 维护笔记二

    1.实现外网访问内网的远程桌面 单位机器服务器的IP地址是10.3.198.108,可以上外网,路由器上设置了内网的外网映射地址,内网的地址是192.168.0.* 现在要实现从10.x.x.x的校园 ...

  3. Linux学习笔记三:安装VMWare Tools共享文件夹

    这里写目录标题 概述 window下安装 Ubuntu下安装 提取安装包 解压安装 Ubuntu安装插件 适应窗口和拖拽文件 概述 本文主要是记录下我安装VMwareTools的过程,原本打算写在Li ...

  4. Linux维护笔记四

    关闭SELinux的方法: 修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启. 如果不想重启系统,使用命令setenforc ...

  5. Linux 学习笔记 三

    Llinux上的日志系统 syslog syslog-ng  next generation syslog 服务: syslogd:系统:非内核系统产生的信息 klogd:内核:专门负责记录内核产生的 ...

  6. Linux学习笔记三【文件及目录的权限管理篇】

    文件及目录的权限管理 上篇简单介绍了下文件和目录的一些简单的操作,接下来介绍用户和文件权限的管理.首先了解用户和组账号的配置文件,然后是管理用户和组账号,最后要会设置文件和目录权限和归属. Linux ...

  7. Linux维护笔记五

    一:更换用户身份登录samba 常出现的一种现象是:在建立了访问Samba服务器的连接之后,再次访问该服务器时,不再出现身份认证对话框,这样便无法更换用户身份.造成这一现 在Windodows客户机访 ...

  8. Linux学习笔记(三):系统运行级与运行级的切换

    1.Linux系统与其他的操作系统不同,它设有运行级别.该运行级指定操作系统所处的状态.Linux系统在任何时候都运行于某个运行级上,且在不同的运行级上运行的程序和服务都不同,所要完成的工作和所要达到 ...

  9. 嵌入式Linux驱动笔记(三十一)------SYSRQ组合键使用

    你好!这里是风筝的博客, 欢迎和我一起交流. ALT+SYSRQ组合键是Linux调试的一种手段,即使在系统死机.panic.卡住等情况,只要系统还能响应中断,那么SYSRQ就派上用场了(比如触发cr ...

最新文章

  1. 应用在机器学习中的聚类数据集产生方法
  2. matlab基本操作--基本数学定义
  3. php去掉内部空格_php中去掉头尾空格3种方法
  4. 集群理论详解(续一)
  5. 看电影“刺客聂隐娘”前必须了解的知识(绝无剧透)
  6. RISC-V MCU 智能语音物联网家居控制系统
  7. 【论文笔记】Image Tampering Localization Using a Dense Fully Convolutional Network
  8. 安天移动安全:重视用户个人信息保护,是App长效发展的关键
  9. Django短信验证码
  10. 抖音怎么用计算机数字等于中文字,抖音数字表白公式怎么玩 抖音数字表白从1到100攻略...
  11. mailgun_用Mailgun邮寄出去!
  12. 电路matlab搭建,MATLAB电路仿真搭建教程
  13. 软件测试需要掌握哪些知识?软件测试基础理论
  14. 【十四】【vlc-android】aout音频输出模块源码实现分析【Part 2】
  15. DBA与项目的那堆事 ——目录
  16. cad怎么画坐标系箭头_怎样用CAD画一个路标箭头?,来学习吧
  17. Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
  18. 部署HPC集群的实施方案
  19. Mac系统Audition CS6的破解安装与汉化
  20. 一名不务正业的程序员书单【持续更新】

热门文章

  1. 当我们在聊监控,我们在聊什么?
  2. Windows 10体验:文件资源管理器变成了首页
  3. warning: the frame size of 1040 bytes is larger than 1024 bytes
  4. HP DL388G5 安装64位linux虚拟系统出错!
  5. 设置硬盘休眠linux,linux笔记本设置休眠
  6. python文件目录操作方法_Python常用的文件及文件路径、目录操作方法汇总介绍
  7. c语言中的素数定理,素数定理
  8. php如何获得文件数量,PHP:获取目录中文件数量的最有效方法
  9. 轻松上手系列教程java_小白也能轻松上手的Prometheus教程
  10. python open permission denied_python - Image.open PermissionError:[Errno 13]权限被拒绝: - 堆栈内存溢出...