![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 01:53 AM |
| Solaris 8 - Asks for current root password when trying to change root password. | tferrazz | SUN Solaris | 8 | 04-07-2009 03: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 11:03 AM |
| Change password by pushing encrypted password to systems | benq70 | UNIX for Dummies Questions & Answers | 1 | 09-02-2005 10:08 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
oh i see you didn`t understand me.
I will show you like this. This is a bash script wich perfom uname -a with password protected so if you know the password you get the uname -a else exit.danremo`s script thx. -- pass=espana echo -n "Type password:"; read pass2; if [ ${pass}. != ${pass2}. ]; then echo "Wrong password, bye"; else echo OK password acepted !; uname -a fi -- now, what i am searching about is the same thing only writed in c++ wich i have very little knowledge about. thank you ! |
|
||||
|
Code:
/* mypass.c */
#include <stdio.h>
#include <unistd.h>
#include <string.h>
int main(int argc, char **argv)
{
char *pswd="espana";
char *result=getpass("Enter password");
if(strcmp(pswd, result)==0 )
return 0;
return 1;
}
Code:
./mypass
if [ $? -eq 0 ] ; then
uname -a
else
echo 'bad password'
fi
|
|
||||
|
yes this is what i looking for !
thanks man ! very very nice ! ---------- Post updated at 01:45 PM ---------- Previous update was at 01:43 PM ---------- i am wondering if there is any chance to hide the password ? when i strings the file shows : /lib/ld-linux.so.2 _Jv_RegisterClasses __gmon_start__ libc.so.6 getpass system strcmp _IO_stdin_used __libc_start_main GLIBC_2.0 PTRh espana <-- Enter password dont know , some md5sum maybe ? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|