LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-29-2010, 07:14 AM   #1
anil007523
LQ Newbie
 
Registered: Jul 2010
Posts: 16

Rep: Reputation: 2
password code


hi...
well i am new to linux programming. can any one give the code for password.
that means when we enter password it has to check it with root password and return the value.
i'm working on security for files. If we leave the system open any one can see the contents of it.so i want to write a system call for security to files.It will ask the password for all the files.And i'm not a cracker or a professional programmer.This is my mini project and has to submit it very soon so plz help me soon
please help me out from this from last 2 months i'm trying.
thank you in advance.

Last edited by anil007523; 07-29-2010 at 07:37 AM.
 
Old 07-29-2010, 07:19 AM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by anil007523 View Post
hi...
well i am new to linux programming. can any one give the code for password.
that means when we enter password it has to check it with root password and return the value.
IMO you can find the root password only through /etc directory which itself requires a root password.

and I find this thread suspicious.
 
1 members found this post helpful.
Old 07-29-2010, 07:21 AM   #3
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
Your going to need to explain more about what exactly your trying to achieve.

It SOUNDS like your trying to build a password cracker, but that wont work if you can't access the place the hashes of the passwords are stored (which is passworded...).

If its something else then maybe we can assist...
 
1 members found this post helpful.
Old 07-29-2010, 07:54 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
It does not matter whether you are root or not. Even if you can read /etc/shadow, you will not be able to de-crypt the encrypted passwords.

Please post more information on what exactly you need to do, and why. It sounds like homework, but no responsible teacher is going to give out assignments on how to retrieve passwords.
 
2 members found this post helpful.
Old 07-29-2010, 07:57 AM   #5
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by pixellany View Post
It does not matter whether you are root or not. Even if you can read /etc/shadow,
What did you mean by this ? One can't read even the /etc files.
Code:
anisha@linux-uitj:~> cat /etc/shadow
cat: /etc/shadow: Permission denied
 
1 members found this post helpful.
Old 07-29-2010, 07:59 AM   #6
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
Lightbulb

Quote:
Originally Posted by pixellany View Post
Please post more information on what exactly you need to do, and why. It sounds like homework, but no responsible teacher is going to give out assignments on how to retrieve passwords.

Why not, isn't part of learning about security learning how to break into something?

Of course it has to come with lessions about the ethical implications of what your doing, or might use it for.

anil007523 - Please don't edit your original post for additions, instead post a new post so we can see what you've added - makes following the convo alot easier.
 
2 members found this post helpful.
Old 07-29-2010, 08:02 AM   #7
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
Quote:
Originally Posted by anishakaul View Post
What did you mean by this ? One can't read even the /etc files.
Code:
anisha@linux-uitj:~> cat /etc/shadow
cat: /etc/shadow: Permission denied
You've just proven what pixellany said, You can't access files, even if the workstation is unlocked you've got no access beyond that of the user your logged in as.

UNLESS you left it logged in as root, but this is idiotic and if someone did this then there is no security which would protect them (other than the fact the content of some files is encrypted.)
 
2 members found this post helpful.
Old 07-29-2010, 08:14 AM   #8
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by djsmiley2k View Post
You've just proven what pixellany said, You can't access files, even if the workstation is unlocked you've got no access beyond that of the user your logged in as.

UNLESS you left it logged in as root, but this is idiotic and if someone did this then there is no security which would protect them (other than the fact the content of some files is encrypted.)
Pixel said "Even if you can read /etc/shadow,...", so my question was since through cat command I can't see the shadow file, then how can I read or Decrypt it ?

though I don't understand "workstation is unlocked"
 
1 members found this post helpful.
Old 07-29-2010, 08:16 AM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by djsmiley2k View Post
Why not, isn't part of learning about security learning how to break into something?
You have a good point.
 
1 members found this post helpful.
Old 07-29-2010, 08:16 AM   #10
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
Quote:
Originally Posted by anishakaul View Post
Pixel said "Even if you can read /etc/shadow,...", so my question was since through cat command I can't see the shadow file, then how can I read or Decrypt it ?

though I don't understand "workstation is unlocked"
Only root can read that file. You must be logged in as root to see the content (which is then encrypted as well).

By unlocked, I mean someone has left it logged in and not secured it after using it.


--------------

Slightly offtopic - Is this for your disseration at university? The fact you've been working on it for two months, and want it so soon makes me feel that it maybe. If so your going to have to define the problem your trying to fix more clearly as I dont see exactly what your trying to prove.

Last edited by djsmiley2k; 07-29-2010 at 08:19 AM. Reason: Offtopic note.
 
1 members found this post helpful.
Old 07-29-2010, 08:21 AM   #11
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
root can read (and write) ALL files or--if necessary--can change the permissions to enable it.

But--if I am not mistaken--
NO-ONE can decrypt the entries in /etc/shadow.
 
1 members found this post helpful.
Old 07-30-2010, 12:50 AM   #12
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by pixellany View Post

But--if I am not mistaken--
NO-ONE can decrypt the entries in /etc/shadow.
If even root can't do so, does it mean that I can't get my old password back if I have lost it ?
 
2 members found this post helpful.
Old 07-30-2010, 08:43 AM   #13
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by anishakaul View Post
If even root can't do so, does it mean that I can't get my old password back if I have lost it ?
Correct.
 
2 members found this post helpful.
Old 07-30-2010, 11:25 AM   #14
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by pixellany View Post
Correct.
Alright I can safely conclude now that no one can ever write a program for finding the root password or any other password in Linux.
 
2 members found this post helpful.
Old 07-30-2010, 12:06 PM   #15
anil007523
LQ Newbie
 
Registered: Jul 2010
Posts: 16

Original Poster
Rep: Reputation: 2
Thank you for the information.
 
  


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
LXer: Ruby On Rails password protection can be nullified due to flawed code LXer Syndicated Linux News 0 06-06-2009 01:20 AM
simple encyption code with password for movie files (large files) ufmale Programming 1 09-13-2008 11:36 PM
code for /etc/pam.d/system-auth(password complexity) moinpasha Programming 0 09-18-2006 01:23 AM
Password entry in C code zaichik Programming 1 02-01-2005 08:02 AM
How do I put root Password from code in sudo ? rhawi Programming 8 06-18-2004 12:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:44 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