Page 1 of 1

OS shell..

Posted: Thu Jan 08, 2004 12:00 am
by nm
Hi!

I have the following question..
I'm working on a multiuser OS, that is supposed to separate the rights (permissions). The question is how can I make different users execute different commands? For example user "root" can execute whatever command he wants, but user "guest" can't do that. Any suggestions are welcome..

Thanks.

RE:OS shell..

Posted: Thu Jan 08, 2004 12:00 am
by Dangamoose
Well Linux has the permissions that allow read write and execute for owner, group and public users.

A particular program is set to owner root, then the permissions set for only root to execute that particular program.

You could also do the same with the group.

Windows also has a similar pattern, but its not officially native to the OS but through something known as Active Directory, a chunky service.

RE:OS shell..

Posted: Thu Jan 08, 2004 12:00 am
by St8ic
If security and quality aren't of concern you could just put something like this before each and every command...

if (strcmp(u%,"root")==false){
    printf("Sorry, only root can do that...\n\r");
else if(strcmp(u%,"root")==true){
    command();

u% being the user, defined when he logs in. Again, this system would pose a huge security flaw, but it would be good temporarily until you could figure it out.