root privileges


 
Thread Tools Search this Thread
Top Forums Programming root privileges
# 15  
Old 11-19-2005
That's right. You need access to the encrypted password in order to verify that the user typed in a password that matches it. What did you expect? Do you think that su can verify that you typed in the root password without looked at the encrypted password? Well, here's a clue..su obtains the encrypted string and verifies the entered password using exactly this method.
# 16  
Old 11-20-2005
i think that the simplest solution to solve this problem is to use the kdesu program , supplied with kde.

you'll have to run your program with this command :

Quote:
kdesu myprogram
kde will display a dialog box which let the user type the root password or exit.
# 17  
Old 11-21-2005
thanks

kdesu is GUI flavour of su.
but i want to implement it after execution of the program.
mean...

I execute my application say ( ./test )
then I check the user inside the application and if it not root I prompt the user.
# 18  
Old 12-29-2005
Hi Perderbo,
I am going to look foolish asking this question, but it is bothering me.

"Well, here's a clue..su obtains the encrypted string"

where does su obtain this encrypted string from ?
lets say root password is "unix.com". Lets also assume that su has somehow got the encrypted string for "unix.com". But what is the key it has used for encryption?
Since this is not known, if I have to simulate su, how do I get this encrypted string ?

so for eg su internal encrypted "unix.com" using key say "linuxpenguin", and encrypted key is "perderabo"
Now, I am simulating su, I have the encrypted string "perderabo" (dunno where i got it from, somehow I got it), my program prompts for password, which the user enters as say "unix.com" (hacker huh!! ), so now how do I encrypt this. Essentially I need to know the encrypted password and encryption key, both ? well then I would have even encrypted the root password Smilie
Can you please explain me understand this.

Regards
# 19  
Old 12-29-2005
ok, is this the /etc/shadow file, that contains the encrypted passwords? Even if it does, then what is the encryption key that su uses?
# 20  
Old 12-29-2005
Try 'man 3 crypt'. If I'm not mistaken, the encryption 'salt' is stored with the encrypted password.
# 21  
Old 12-29-2005
Take a look at the code I posted. I sidestepped the issue with:
#define ENCRYPT "O26nQUAUM2vLA"
but the su program obtains the encrypted string from somewhere. Exactly where varies. It might be /etc/passwd. It might be /etc/shadow. It might be NIS or NIS+. There are other options too. All that matters is that the local su program knows where to obtain the encrypted string. And it gets the plaintext candidate password interactively from the user. Then it uses the code I posted to compare the two. (Or something pretty similiar. )

I think that what is bothering you is a missing piece of data. Usually we think of something roughly like this: PLAINTEXT + KEY = CHIPHERTEXT

Actually the cleartext password is the key and the encrypted password is the chiphertext. So where is the plaintext? It is a well known constant stored in crypt routine. This is why the Unix password is locked at 8 characters in length. It is easy to increase the length of the cleartext but a new algorithm is needed to the size of the key. They had to do it this way. If the key was stored in the source code, everyone (who cared) would know it and anyone could use it to decrypt the password. But there is no way to take the plaintext and the chiphertext and recover the key. They wanted the password to be secure even if you had the source code for crypt() and the encrypted password. Even today, all these decades later, brute force is still the only viable attack. The weakness of the Unix password scheme is that today brute force is feasible against an 8 character password. crypt() is actually an amazing piece of work.

The salt is just basicly one of 4096 random strings added to password. So if my password is "bullfrog" the encrypted password will be one of 4096 results. This makes it harder to recognize that two accounts have the same password. And if you try to build a database of possible encrypted strings, your job is now 4096 times harder.

The Unix password scheme is described in the paper Password Security: A Case History by Robert Morris and Ken Thompson. This is not the RTM who wrote the Morris Worm; this is his father. I found a copy in the UNIX System Manager's Manual which was part of the 4.3 BSD documents dated April, 1986. But I think that paper is circa 1975 or so. It is a very early paper. BTW, Morris and Thompson also wrote the crypt() routine itself.

[EDIT]
I found that paper at the ACM website: Link
Published in 1979 I see... oh well, I had the right decade! Smilie

Last edited by Perderabo; 12-29-2005 at 10:44 PM.. Reason: Add link to paper
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Infrastructure Monitoring

Monitoring tools that do NOT require root privileges

Hi guys, I am currently managing an application running on around 150 servers. I only have application usage rights on those servers and do not have any root privileges. I have an external node that can connect to those servers and I have root privileges on that one box. I want to setup... (2 Replies)
Discussion started by: Junaid Subhani
2 Replies

2. UNIX for Dummies Questions & Answers

Can you gain root privileges if the suid program does not belong to root?

I had a question in my test which asked where suppose user B has a program with 's' bit set. Can user A run this program and gain root privileges in any way? I suppose not as the suid program run with privileges of owner and this program will run with B's privileges and not root. (1 Reply)
Discussion started by: syncmaster
1 Replies

3. HP-UX

User with root privileges in hp ux

hi, i am new in hp ux and i must create a user with root privileges and so i disable ssh connection from root login. thanks.. (6 Replies)
Discussion started by: eliste
6 Replies

4. Solaris

Gaining root privileges

Hello I am a new (and only) administrator of a Solaris 10 environment. The previous admin gave me a use (say user123) that is supposed to have administrative privileges. Now the problem is, the user does not have this privilege! Here is what i tried so far: $ id uid=109(user123) gid=1(other)... (3 Replies)
Discussion started by: abohmeed
3 Replies

5. Shell Programming and Scripting

Privileges like root

My English is no very good. I must make a bash scripting sh create like a backdoor, and when execute the script a user without privileges convert in super user or root, whithout introducing the password. In Spanish: Crear un script que sirva como puerta trasera al sistema, de manera que al... (1 Reply)
Discussion started by: kitievbr
1 Replies

6. Shell Programming and Scripting

Python: Bind to port 80 as root, then drop privileges?

I have written a small web server in Python, and now I would like to run it on port 80, but in order to be able to bind to a port below 1024 I need to have root privileges. I don't want to run the server as root, though. How can I bind to port 80 as root and then drop root privileges? Thankful... (0 Replies)
Discussion started by: Ilja
0 Replies

7. Linux

grant root privileges to ordinary user

Hi, Is it possible to grant root privileges to an ordinary user? Other than 'sudo', is there some way under Users/Groups configuration? I want ordinary user to be able to mount, umount and use command mt. /Brendan (4 Replies)
Discussion started by: brendan76
4 Replies

8. UNIX for Dummies Questions & Answers

root privileges

Hello, As admin with root rights, to execute any command from another user without password-ask, I do : su - <user> -c "<cmd>" But how can I do to give the same rights to another physical user without using root user ? :confused: I've try to create another user "toor" with the same primary... (4 Replies)
Discussion started by: madmat
4 Replies

9. Solaris

sshd (openssh) on SunOS without root privileges

Hi, I've just managed to install openssh in my home directory on a server I have access to by using --prefix=$HOME/local after ./configure. Another thing I was having trouble with without root access was privilege separation, so I disabled that in my sshd_config. However, when I run... (10 Replies)
Discussion started by: sayeo
10 Replies

10. UNIX for Dummies Questions & Answers

Root privileges &Sudoer

Hi guys... how can a root assign a user all or most of the root privileges? is sudoer comand enough 4 this? thx alot.. (2 Replies)
Discussion started by: blue_7
2 Replies
Login or Register to Ask a Question