Linux 初始化系统配置(CentOS 6)

Linux 初始化系统配置(CentOS 6) ,在配置服务器之前一般都需要根据自己的需要对系统进行初始化的一些工作,我自己在配置服务器之前都会做些初始化的配置 这里主要包括5个设置:

1. 限制某些用户使用su命令

2. 限制只能wheel组能使用sudo命令

3. 演示让普通用户使用root命令(自己玩的使用)

4. 配置服务 关闭一些你不需要的服务

5. 更新yum在线库 寻找最快的软件仓库

6. 关闭SELINUX

7. 对linux的文件权限补充(对于服务器配置来说很重要的知识点)

1 控制cent用户能使用su 命令 登入root用户

root:cen

------------------------------------------ 2 控制只能wheel组能使用sudo命令

[root@bogon ~]# vi /etc/sudoers root ALL=(ALL) ALL # Uncomment to allow people in group wheel to run all commands %wheel ALL=(ALL) ALL 添加wheel组能使用sudo命令 # Same thing without a password %wheel ALL=(ALL) NOPASSWD: ALL

下面自定义一些权限控制 比如控制所有用户除了root都不能执行 关机 重启命令 Cmnd_Alias SHUTDOWN = /sbin/halt, /sbin/shutdown, \ /sbin/poweroff, /sbin/reboot, /sbin/init # add ( commands in aliase ‘SHUTDOWN’ are not allowed ) cent ALL=(ALL) ALL,!SHUTDOWN不能执行关机命令

sudo是linux下常用的允许普通用户使用超级用户权限的工具。它的主要配置文件是sudoers,linux下通常在/etc目录下,如果是solaris,sudo都提供了一个编辑该文件的命令:visudo来对该文件进行修改。强烈推荐使用该命令修改sudoers,因为它会帮你校验文件配置是否正确,如果不正确,,在保存退出时就会提示你哪段配置出错的。言归正传,下面介绍如何配置sudoers

首先写sudoers的缺省配置:

################################################# # # 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# Cmnd alias specification# Defaults specification# User privilege specificationroot ALL=(ALL) ALL# Uncomment to allow people in group wheel to run all commands# %wheel ALL=(ALL) ALL# Same thing without a password# %wheel ALL=(ALL) NOPASSWD: ALL# Samples# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom# %users localhost=/sbin/shutdown -h now##################################################

现在睡觉的话,会做梦;而现在学习的话,会让梦实现。

Linux 初始化系统配置(CentOS 6)

相关文章:

你感兴趣的文章:

标签云: