LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-09-2010, 06:02 PM   #1
karlochacon
Member
 
Registered: Dec 2006
Posts: 109

Rep: Reputation: 17
Disable exit


hi guys

I'm working in a simple script which simulates th shell
basically my customer wants a menu in linux which will be the only access for operators.... and they don't want them to have direct shell access so below is the best I could do... now I am having problems to handle the exit command since I only want end as my exit command

is there a way to do that? using if or something?

Code:
     #!/bin/bash
     while [ "$whichcmd" != end ]
     do
     read whichcmd?"Enter Command: "
     $whichcmd
     done
     whichcmd=0
What I need is someone enters the command exit


thanks a lot
 
Old 09-09-2010, 07:57 PM   #2
AsusDave
Member
 
Registered: Jul 2008
Distribution: Debian, Ubuntu 10.04
Posts: 151

Rep: Reputation: 34
So... Do they want the users to only have access to a "kiosk" style system, or do you need a simulated shell environment? I was a tad confused after reading your post.

If you just want a kiosk, I think there have been several discussions here on setting one up. The search function may be of help.

HTH
Dave
 
Old 09-09-2010, 08:06 PM   #3
karlochacon
Member
 
Registered: Dec 2006
Posts: 109

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by AsusDave View Post
So... Do they want the users to only have access to a "kiosk" style system, or do you need a simulated shell environment? I was a tad confused after reading your post.

If you just want a kiosk, I think there have been several discussions here on setting one up. The search function may be of help.

HTH
Dave
simulated shell environment that's why the script above but I want something like when exit is typed say "Not allowed" and continue to promt again to type more commands
 
Old 09-10-2010, 10:04 AM   #4
kopper27
Member
 
Registered: Nov 2009
Posts: 147

Rep: Reputation: 16
sorry typed on the wrong thread
 
Old 09-10-2010, 10:06 AM   #5
karlochacon
Member
 
Registered: Dec 2006
Posts: 109

Original Poster
Rep: Reputation: 17
it fixed guys
I used exec script_name to load the script so when user type exit...the menu will log out the linux session

now guys as I said that code above is a simulated linux shell very basic....

is there a way to improve it?

commands like these ones won't work

Code:
/sbin/ifconfig -a | less
/sbin/ifconfig > ip
it looks like when using | or > or similar characters my simulated command line won't work

any idea how to improve this simulated command line?

thanks a lot
 
Old 09-10-2010, 03:48 PM   #6
karlochacon
Member
 
Registered: Dec 2006
Posts: 109

Original Poster
Rep: Reputation: 17
no problem guys
Code:
eval $whichcmd
will do the job
 
Old 09-10-2010, 08:58 PM   #7
AsusDave
Member
 
Registered: Jul 2008
Distribution: Debian, Ubuntu 10.04
Posts: 151

Rep: Reputation: 34
I am wondering, would it work better to put your users into a "restricted" group, then change the permissions on the commands you don't want them to run to not include execute permissions for that "restricted" group?

I'm just trying to advance from an alternate direction.

HTH
Dave
 
Old 09-11-2010, 12:55 PM   #8
karlochacon
Member
 
Registered: Dec 2006
Posts: 109

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by AsusDave View Post
I am wondering, would it work better to put your users into a "restricted" group, then change the permissions on the commands you don't want them to run to not include execute permissions for that "restricted" group?

I'm just trying to advance from an alternate direction.

HTH
Dave

how can I achieve that? restricted groups?
 
Old 09-11-2010, 09:02 PM   #9
AsusDave
Member
 
Registered: Jul 2008
Distribution: Debian, Ubuntu 10.04
Posts: 151

Rep: Reputation: 34
Basically, you create a group, name it whatever you like (you could use "restricted" if you wanted to), depending on which distro you are using, the steps may vary a little. You then change the permissions on the programs you want to run (exit, apt-get, aptitude, yum, etc) to exclude this new group.

Now anyone you add to this group will be unable to run the commands you have "turned off"

This is the 30,000 ft view of groups, your google-fu will serve you well digging into the particulars.

HTH
Dave
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] exit in script files cause konsole terminal itself to exit Star_Gazer Programming 11 04-12-2010 08:32 AM
How to exit and save (or just to exit) inside a "make config" running command? scrat75 Linux - Kernel 6 09-05-2008 04:02 PM
Warning: at kernel/exit.c:814 do exit() (Tainted: P ) <- nVidia video problem? Hitboxx Fedora 2 10-06-2007 09:47 PM
dbx command for corrosponding commands disable or disable on gdb bshankha AIX 0 09-26-2006 09:38 AM
difference between exit 1 and exit kushalkoolwal Programming 6 10-20-2005 03:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration