【Linux桌面应用】sudo的用法及配置
sudo是linux下常用的允许普通用户使用超级用户权限的工具。
它的主要配置文件是sudoers,linux下通常在/etc目录下,如果是solaris,缺省不装sudo的,编译安装后通常在安装目录的 etc目录下,不过不管sudoers文件在哪儿,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 specification
root 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
##################################################################
1. 最简单的配置,让普通用户support具有root的所有权限
执行visudo之后,可以看见缺省只有一条配置:
root ALL=(ALL) ALL
那么你就在下边再加一条配置:
support ALL=(ALL) ALL
这样,普通用户support就能够执行root权限的所有命令
以support用户登录之后,执行:
sudo su -
然后输入support用户自己的密码,就可以切换成root用户了
2. 让普通用户support只能在某几台服务器上,执行root能执行的某些命令
首先需要配置一些Alias,这样在下面配置权限时,会方便一些,不用写大段大段的配置。Alias主要分成4种
Host_Alias
Cmnd_Alias
User_Alias
Runas_Alias
1) 配置Host_Alias:就是主机的列表
Host_Alias HOST_FLAG = hostname1, h
相关文档:
题目:在Linux下的MATLAB中运行MATLAB程序并在web中显示结果
我做了一个例子主要有5个文件:
webtttt.html webtttt1.html webtttt2.html webtttttempt.html webttttrnd.m
1.webtttt1.html文件
<!-- $Revision: 1.2 $ -->
<HTML>
<HEAD>
<TITLE>Simulat ......
http://www.mcublog.com/more.asp?name=sharkdn&id=8810
=======================================
好些时候,我们需要一个只要一张软盘就能启动Linux 的系统,比如说做路由器。但是我们该怎样做呢? 也就是说我们要把Kernel和FileSystem都做在一张3.5'的盘上。我们先把FileSystem 分解成如下几个部分吧。
1. /b ......
Linux中wait用法:
系统中的僵尸进程都要由wait系统调用来回收。
函数原型:
#include<sys/types.h>
#include<sys/wait.h>
pid_t wait(int *status);
进程一旦调用了wait就立即阻塞自己,由wait自动分析是否当前进程的某个子进程已经退出,如果让它找到了这样一个已经变成僵尸的子进程,wait就会收集这 ......
MTD(memory technology device内存技术设备)是用于访问memory设备(ROM、flash)的Linux的子系统。MTD的主要目的是为了使新的memory设备的驱动更加简单,为此它在硬件和上层之间提供了一个抽象的接口。MTD的所有源代码在/drivers/mtd子目录下。我将CFI接口的MTD设备分为四层(从设备节点直到底层硬件驱动),这四层从上到下 ......
iptables-save > ipt.v1.0
iptables-save > ipt.v1.1
iptables-restore < ipt.v1.0
cp /etc/sysconfig/iptables iptables.raw
service iptables save
ip伪装的脚本文件iptables_masquerade
#!/bin/bash
//设置linux系统允许ip包的转发
echo "1" > /proc/sys/net/ipv4/ip_forward
//加载实现 ......