linux 权限&&计划任务

怎样使两个用户对一个文件同时有写权限?
eg.授权用户jack ,marry 对目录 /software有写权限
1.添加一个用户组 : groupadd software
2.usermod -G software jack
3.gpasswd -a marry software
4.chgrp softadm /software
5.chmod g+w /software

1.远程登录时 显示pts
2.本机登录时 显示tty
用户管理命令:
1.pwck 检测etc/passwd 文件(锁定文件)
2.vipw 编辑etc/passwd 文件
3.who 查看当前登录信息。
4. su zeng 与 su - zeng 不同。“-”会切换环境变量
5.锁定用户 :passwd -l username or usermod -L username
6.用户解锁:passwd -u username or usermod -U username
用户组管理的命令:
1.groups查看用户隶属于哪些用户组。
2.newgrp 切换用户组
3.grpck 用户组文件检测
4.vigr 编辑/etc/group 文件(锁定文件)

chage :设定密码。
-l 查看用户密码设置
-m 密码修改最小天数
-M 密码修改最大天数
-d 密码最后修改日期
-I 密码过期后,锁定账户的天数
-E 设置密码过期日期,如果为0,代表密码立即过期,如果为-1,代表密
码永不过期,
-W 设置密码过期前,开始警告的天数。

限制用户su为root:
1.groupadd sugroup
2.chmod 4550 /bin/su
3.chgrp sugroup /bin/su
4. ls -l /bin/su
设定后只有sugroup组中的用户可以使用su切换为root


1.权限控制精细化
2.sudo 代替su

密码破解软件:John the ripper(可以用于检测用户的密码强度)
安装 John the ripper
1. tar -xzvf john-1.7.6.tar.gz
2. cd john-1.7.6/run
3. make
eg.破解用户liming的密码:
1.grep liming /etc/passwd > /test/liming.passwd
2.grep liming /etc/shadow > /test/liming.shadow
3./test/john-1.7.6/run/unshadow /test/liming.passwd
/test/liming.shadow > /test/liming.john
4./test/john-1.7.6/run/john /test/liming.john
Download address: http://www.openwall.com/john

----------------------------------------------------------
计划任务:
1.at 安排作业在某一时刻执行一次
at [-f 文件名] 时间
绝对计时法 midnight noon
hh:mm[today]
hh:mm tomorrow
hh:mm 星期
hh:mm MM/DD/YY
相对计时法:
now + n minutes
now + n hours
now + n days
使用命令文件方式
1.生成文件 test_at.script:
2.使用at命令
at -f test_at.script 9:00 2/2/11
or
at < test_at.script 9:00 2/2/11
at -l or atq查看队列中的任务
at -d or atrm 删除队列中的任务

2.batch 安排作业在系统负载不重时执行一次。
3.crontab 用于周期性的任务
crontab -e
把知道的具体时间添加上,不知道的都添加上*
分钟 小时 天 月 星期 命令/脚本 (六个部分)
0 4 * * *
0 18 * * 2,5
0 18 * 1-3 2,5
*/2 12-14 * 3-6,9-12 1-5
notice:1.这些项都不能为空,必须键入
2.用户必须具有运行命令的权限。

linux中进程处理的方式:
1.standalone 独立运行
2.xinetd 进程托管
3.atd、crond计划任务

posted @ 2012-03-01 23:09  Alex-Zeng  阅读(342)  评论(0编辑  收藏  举报