500分求一Linux下C语言程序!(分数还可以加倍,只要实现功能)
题目要求如下,要求有注释:
Students are required to design, implement and test a program which will run within the L150 Linux facility or similar. This program may either be written using a combination of modules written using 'C' and Bash shell script supported by standard Posix command utilities such as sed(1), awk(1), grep(1) etc or alternatively entirely in Perl.
This program is required to modify system data files in a suitable manner for creating or removing a user login account on the operating system. The end user of this program must be able to use it to add and remove entries relevant for a specified user.
As administrator access to TIC supported Linux facilities is not feasible, the program to be designed and implemented by the student must support command line parameters suitable for specifying alternative paths for copies of the relevant system files which would need to be updated if this program were to be run by the root user.
The program must be able to add and remove records to and from copies of files with the same format and organisation as the /etc/passwd and /etc/group files as documented in the system manual pages: passwd(5), shadow(5) and group(5). Use of the system call:crypt(2) is required for the creation of one-way hashed passwords from plain-text passwords. The program should test if it is run as user: root and if so, create directory: /home/new_userid with appropriate user and group ownership, where new_userid is the new user login to be created.
要求学生们设计、实现并测试一个能够在L150 Linux或类似设备上运行的程序。这个程序或者可以用一个以"C"语言和Posix标准命令功能所支持的Bash shell脚本如sed(1), awk(1), grep(1)等编写的联合模块来设计编写,或者可以完全用Perl来完成。
要求该程序能通过某种合适的方式修改系统数据文件,以创建或删除一个用户在操作系统上的登录帐号。这个程序的最终用户应当能够用它(这个程序)为指定用户添加并删除相关的登录信息。
作为管理员有权使用被Linux设备支持的TIC(技术情报中心)是不可行的,如果这个由学生设计实现的程序被超级(根目录)用户运行,那么相关的系统文件的复件的路径就需要被更新,而该设计的程序就必须要支持适合指定上面更新路径的命令行参数。
这个程序要能够向文件复件添加记录以及能从文件复件移除记录,这些文件同/etc/passwd、/etc/group文件具有相同的数据格式和结构,这些格式和结构在系统手册页中都有记录:(请参考)passwd(5), shadow(5) and group(5)。系统调用的使用:crypt(2)要求用在从明文口令到单链哈希口令的创建中。如果被超级用户运行,该程序应该检测目录,并且使用适当的用户和组身份创建目录:/home/new_userid,new_userid即新用户登录的用户ID就会在该目录下被创建。
问题点数:100、回复次数:16Top
1 楼stcrane1228(狼族兄弟(LONE_WOLF))回复于 2004-09-01 20:12:27 得分 0
怎么没人回答,高手呢?Top
2 楼yanghuajia(我要抢分)回复于 2004-09-01 22:46:03 得分 0
改成$也很难有人帮你Top
3 楼stcrane1228(狼族兄弟(LONE_WOLF))回复于 2004-09-02 08:37:00 得分 0
这不是我的作业,别人的,我也是帮忙而已。
唉!CSDN不过如此……Top
4 楼serverclient(郁闷)回复于 2004-09-02 09:02:14 得分 10
呵呵,大概什么时候要?
Top
5 楼pacman2000(pacman)(影子传说)回复于 2004-09-02 09:29:39 得分 10
这个题目不难,就是掌握了上面提到的几个函数就可以模拟一套unix的验证文件了。呵呵,怎么看都象作业题,自己动动手呀。Top
6 楼lwj_dxy(豆芽--抵制日货)回复于 2004-09-02 10:49:31 得分 0
呵呵,怎么看都象作业题,自己动动手呀。
Top
7 楼stcrane1228(狼族兄弟(LONE_WOLF))回复于 2004-09-02 15:57:04 得分 0
这是一个朋友的作业题!我不是做这一块的,我用VC++和C#的,所以还请行家给出答案。Top
8 楼stcrane1228(狼族兄弟(LONE_WOLF))回复于 2004-09-02 15:58:31 得分 0
5号前用啊Top
9 楼suowei1979(hacker & hacking)回复于 2004-09-02 16:04:28 得分 5
有难度Top
10 楼stcrane1228(狼族兄弟(LONE_WOLF))回复于 2004-09-02 16:10:19 得分 0
有没有难度我不清楚,只是朋友要我帮忙做的,他没时间做,我又是外行。Top
11 楼joan933(sj)回复于 2004-09-02 16:38:38 得分 15
用shell 可以实现,不过你的目标不明确。
增加: echo 'xxx' >> file
刪除: cat file | sed 's/xxxx//' > tmp; mv tmp file
再判断是否为系統管理員操作:..........Top
12 楼ahcheww()回复于 2004-09-02 19:55:40 得分 0
这位同学,你不乖哦,年初的作业到要交的时候才想起来问人啊?Top
13 楼flyinghawkren()回复于 2004-09-03 13:02:55 得分 0
呵呵,楼主是不是露馅了?楼上的这位跟楼主肯定是一个学校的——或许就是楼主的老师,^_^。可能是暑期课程设计题目吧?Top
14 楼stcrane1228(狼族兄弟(LONE_WOLF))回复于 2004-09-03 16:16:09 得分 0
大家的想象力真是丰富,就是编程水平差点。
我都毕业好几年了,可惜不做这块,唉!Top
15 楼jug(小河马)回复于 2004-09-03 16:42:09 得分 10
use system command
there is an example in "Learning Linux Kernel by Practice" page 31
浙江大学出版社Top
16 楼stcrane(LONE_WOLF)回复于 2004-09-21 13:20:33 得分 50
upTop




