root privileges


 
Thread Tools Search this Thread
Top Forums Programming root privileges
# 8  
Old 11-15-2005
You have to encrypt the password that you take from the user and compare it with the encrypted password. I think that the password encryption header files/libraries will be system dependent, but I am not so sure.
--EDIT--
Could you post your uname -a output anyways? This will help anyone who wants to help you.
--/EDIT--
# 9  
Old 11-16-2005
$ uname -a
Linux sumit 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

but stil I am not sure which encryption algorithm should use to encrypt the password.

thanks

sumsin
# 10  
Old 11-18-2005
See the man page of 'crypt'. I think that may get you started.
# 11  
Old 11-18-2005
Just use:
su root -c /some/script/or/program
and the above line can be placed in a (very short) script. When the user runs the script, su will prompt for the root password.
# 12  
Old 11-18-2005
thanks Perderabo

but I want to run it in GUI mode, so how I use it?
# 13  
Old 11-18-2005
Quote:
Originally Posted by sumsin
thanks Perderabo

but I want to run it in GUI mode, so how I use it?
I guess you have me there. Ok, on HP-UX, I changed a old user's password to the terrible password of "password". This changed his encrypted password to "O26nQUAUM2vLA". I copied that string into a program to sidestep the problem of obtaining it. This varies from system to system. Most systems have an /etc/shadow file, but HP-UX does not. And anyway, your question centered around testing a supplied password against the encrypted string. This program works on HP-UX and Solaris...

Code:
#ifdef __STDC__
#define PROTOTYPICAL
#endif
#ifdef __cplusplus
#define PROTOTYPICAL
#endif

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <crypt.h>

#define ENCRYPT "O26nQUAUM2vLA"

#ifdef PROTOTYPICAL
int main(int argc, char *argv[], char *envp[])
#else
main(argc,argv,envp)
int argc;
char *argv[];
char *envp[];
#endif

{
        static char e[] = ENCRYPT;
        static char pass[9];
        strcpy(pass, getpass("Enter password - "));
        printf(" You entered %s which is %d chars in length \n", pass, strlen(pass));
        if (!strcmp(crypt(pass, e), e)) {
                printf("That is the correct password\n");
        } else {
                printf("That is the wrong password\n");
        }
         exit(0);
}

# 14  
Old 11-19-2005
thanks Perderabo

but this way I have to know the encrypted password of root in advance ( I think that also need root priveleges ) and if root change its password then!

( Actually I want to develop an interface, something like : when you click 'Add/Remove Applications' in 'Systems Settings' in RedHat 9 as a normal user it prompts for root password and after finishing the task you came in your previous state )

thanks
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