Help with su


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Help with su
# 1  
Old 02-26-2009
Help with su

I was trying to use "su - <account>" but it prompts me for password in interactive mode. How do I write main.sh script that executes various commands by logging in as different accounts and login profiles. Is there a way to automatically redirect the password for "su" command to accept the password.

Please guide me further...

Thanks...
# 2  
Old 02-26-2009
It is very difficult to redirect a password into su and this is intentional. Storing passwords and automatically logging into accounts is very dangerous and often a bad idea.

sudo can be configured to login without passwords, it is very flexible; but be careful to only give such permissions in a very limited and specific way.
# 3  
Old 02-26-2009
Help with su

Hi,

I already tried using sudo but i don't have access to it,so that's why i am compelled to use it with su..

Is there no way out by which we can pass the password along with the username while using su....
# 4  
Old 02-26-2009
What you could do is make "root" the owner of the file (and chmod 500), and then run your script. It won't prompt "root" for passwords.
# 5  
Old 02-27-2009
Help with su

Hi,

I can't make the roort owner of the file as I don't have rights to do so.

Is there no other alternative to do so???

I have heard about expect utility ,but it also works for root only.

Can anyone give any solution to the problem ?

thanks in advance...
# 6  
Old 03-02-2009
Help with su

Can anyone help me for the above??

I am unable to implement the logic of expect in my script.

Any help of whatsoever magnitude may prove very useful..

Thanks in advance...
# 7  
Old 03-02-2009
Instead of using su or sudo, you could use ssh with key-based authentication. See my reply on a similar thread here:

https://www.unix.com/unix-advanced-ex...#post302274343
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question