LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-02-2002, 02:59 AM   #1
xlord
Member
 
Registered: Mar 2002
Posts: 75

Rep: Reputation: 15
exit


anyone knows how to use the exit command in shell scripting
like for example.. if i was to give someone a shell acc.. they would have to
enter there passwd to loggin right.. well i want it so that the script that i have will ask them for another secret pass.. and if they get it wrong.. then it will log them off the shell
 
Old 11-02-2002, 08:12 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Not an answer to your question, but in the security sense of it all that doesn't make much sense, because the person has to know/bruteforce 2 passes, one of them being in the script that handles logins if I follow your previous scripting spree :-]
What does having 2 passes protect you against? Nothing. For instance if they share their passes amongst friends/fellow crackers it wouldn't matter, wouldn't it?

Furthermore, since you're not prolific in shell scripting, is it safe to assert you are no experienced Linux user as well? If so, then it would be advisable to first look into securing your box against attacks, because if you invite ppl onto your system you can't fully trust there always will be some who will go that extra mile to gain root an easy way, and already having a local account makes it easier to probe for apps with a bad rep or try out new stuff.

Ok, that said, the bash builtin is called "logout" (man bash) and it will only work in the login shell, $SHLVL -ge 1 shells use "exit".

Need stupid example?: "if the (supplied value for) pass1 doesn't match (value for) pass1, or if the (supplied value for) pass2 doesn't match (value for) pass2, then logout", which translates in bashspeak to:
if [ "$pass" != "pass" -o "$secret_pass" != "secret_pass" ]; then logout; fi
 
Old 11-02-2002, 09:46 AM   #3
xlord
Member
 
Registered: Mar 2002
Posts: 75

Original Poster
Rep: Reputation: 15
Lightbulb

no it is not for my shell .. it is for project.. a scholl project.. if it was like that then i would off just modified bashrc or created a prob in c or someting.. im new to shell scripting... im not stupid enough to actualy let someone ssh to me if i dont know who that person is or if i didnt know how to secure it.. (btw my box is well secured just in case =) ) i really didnt think i hade to explain my self in this way.. but i guess i should of in the first place.. well anyways.. thanx for your worm reply
 
Old 11-02-2002, 12:05 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
This definately is a sad joke.

I really don't like it when I find out I have been wasting my time providing answers for people who are sposed to study this but rather stoop to letting other ppl solve their probs for them.
 
Old 11-02-2002, 07:08 PM   #5
xlord
Member
 
Registered: Mar 2002
Posts: 75

Original Poster
Rep: Reputation: 15
No i didnt ask for people to solve my problem .. all i ask was for some help .. but if asking for some help in this forum..is a crime.. then i guess this forum is not worth posting at all.. you didnt waist your time.. posting a reply to my post.. but you should rethink what you are saying.. AGAIN i didnt ask anyone to solve the problem.. all i ask was for some help.. is this possiable in this forum? or NOT? cause from what it sounds like... it is not..

asking to solve your prob is one thing.. asking for help is another.. thanx have a good day

Last edited by xlord; 11-02-2002 at 07:14 PM.
 
Old 11-03-2002, 06:37 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Look, you miss my point. I'll support anyone's quest for knowledge good or bad, so it's not in the asking for assistance, hits, advice, help, solution etc etc whatever's in a name.

What I mean is it's the fact that you didn't tell upfront this was for a school project. I just don't like to find out I'm helping ppl with an assignment/project/whatever when they're sposed to be learning that stuff themselves.

Just my opinion, other board members may not agree, also note I'm not writing this as moderator but as your average LQ board member,
---
not applicable where forbidden by law, firearms allowed on premises, hang coat in hallway, wash hands before dinner, firm members excluded.
 
Old 11-03-2002, 10:14 AM   #7
xlord
Member
 
Registered: Mar 2002
Posts: 75

Original Poster
Rep: Reputation: 15
i admit at one point you are correct.. but in another i am also... im sorry that i was not a bit more complete.. but sometimes even a great coder needs help.. i just needed to know the syntax on how to be able to do with an exit command that will log out a user of shell.. Sometimes its hard for me to even sit down and start reading book's for the fact that i have to work and take care of my son as me being a single father.. | sorry like i said your right in someways..... i dont mean to sound stupid or lame but sometimes you have to just to get someware.... i know just because your a mod that does not mean that i have to take your power against you.. that is kool i have no problem with that and i know that your a good mod.. but sometimes things are diffrent... but thanx for your help....
 
Old 11-03-2002, 11:33 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Np dude, that's what we're here for, just make sure you wget yourself that copy of the ABS, you'll find it very usefull...
 
  


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
How to exit vi? lommer0 Linux - General 22 12-11-2018 02:04 AM
difference between exit 1 and exit kushalkoolwal Programming 6 10-20-2005 03:56 PM
Exit X Risetaker2003 Linux - Software 5 09-30-2003 08:10 PM
exit X ? w00t Linux - Newbie 11 06-01-2003 08:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:21 PM.

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