The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SSH Password-less login fails on password expiry. Renjesh SUN Solaris 2 04-24-2009 12:53 AM
Solaris 8 - Asks for current root password when trying to change root password. tferrazz SUN Solaris 8 04-07-2009 02:28 PM
how to change root password using shell script with standard password kurva Shell Programming and Scripting 2 02-25-2009 02:35 AM
password verification verify password of a user for only first 8 characters amitpansuria UNIX for Advanced & Expert Users 12 10-23-2008 10:03 AM
Change password by pushing encrypted password to systems benq70 UNIX for Dummies Questions & Answers 1 09-02-2005 09:08 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-18-2009
tavibaroi tavibaroi is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 5
password .c

can somebody provide me an .c with password inside ?
i mean when i rule ./file to ask me for a password and only if i type the right password continues else it exit
i realy need this please. thanks
  #2 (permalink)  
Old 4 Weeks Ago
frank_rizzo frank_rizzo is offline Forum Advisor  
Resident BOFH
  
 

Join Date: Dec 2007
Posts: 426
very odd request. I tried to understand what your trying to do but failed. Can you provide more details?
  #3 (permalink)  
Old 4 Weeks Ago
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,420
People who post homework and repeatedly break the homework posting rules will be banned. Cheaters are not welcome here.
If you post homework, and do not complete the homework template completely and accurately, you will be banned.
You should post your problem on Homework & Coursework Questions - The UNIX and Linux Forums but before that you should read:
  1. Community Spirit and Ethos on Homework & Coursework
  2. Rules for Homework & Coursework Questions Forum

Thank You.

The UNIX and Linux Forums
Reply With Quote


Tip below

Code:
pass=Password;echo -n "Type password:";read pass2;if [ ${pass}. != ${pass2}. ];then echo "Wrong $pass, bye";else echo $pass OK ;fi
  #4 (permalink)  
Old 4 Weeks Ago
tavibaroi tavibaroi is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 5
thank you

this is not my homework, i know looks like one.
Thank you for that code but this is for a bash script and i need it in c++ i mean .c script.
thanks anyway !
  #5 (permalink)  
Old 4 Weeks Ago
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
The safest way to do what you want is to create one special user account - in this example let's call it trial.

1. add the user account
2. logon as trail
3. put the script(s) and data files all in the trial home directory.
4. chmod 700 all of the file(s), including the trial home directory itself.

You now have an application that can be run only by the trial user. (or root)

Your users can get to the tiral application one of two ways
1. login as trial
2. su trial -> requires the password for trial account.
  #6 (permalink)  
Old 4 Weeks Ago
tavibaroi tavibaroi is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 5
thanks for the idea it nice, but i need a passworded .c file.When i run it to ask me the password and only who know that pasword can run it.
thanks again
  #7 (permalink)  
Old 4 Weeks Ago
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
It is not that simple. Do you know about PAM or keberos. for example?
Authentication on your system can be complex. If you are creating a 'secure' app, then you need to follow system rules. If you are trying to keep your little brother off the computer then write some that uses the getpass() call.

man getpass has an example.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0