command su : enter directly


 
Thread Tools Search this Thread
Operating Systems HP-UX command su : enter directly
# 1  
Old 01-18-2009
command su : enter directly

Hi, a simple question : How can I sent user and password to the command su.

I need this for a script, but the problem is the command su wait for the password.

Thanks.
# 2  
Old 01-18-2009
Normally, password reading programs reset their STDIN filehandle in order to ensure input from a terminal. This has the advantage of preventing local brute force attacks at passwords.
An alternative is to install sudo (HP has precompiled binaries for 10.x and 11.x), and setup /etc/sudoers that the required program may be run by a certain user without a need for a password.
Another way might be to use expect to automatically input the password to su, but I advise against it, since saving passwords in clear text is always a bad idea.
# 3  
Old 01-18-2009
If you are usera and you need to run a shell script or login to userb environment (and you have TCP/IP installed and working) remsh or rlogin to your local machine will often do the trick.

See
man .rhosts

First get written permission from userb and the System Administrator because this will allow usera full access to userb files.

In userb home directory , create a .rhosts file with permissions 600, owned by userb and userb's group, containing one line for the local server and usera. All entries are case-sensitive and must be accurate according to the rules.
The password does not appear anywhere.

This technique is not for secure environments and should never be used on a root account. It will fail if the password expires or the account is locked.

Last edited by methyl; 01-18-2009 at 05:43 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automatically enter input in command line

Hi, This is a script which to create an opvn user, I want which answer automatically to a certain part so, I try this, it works without the red part but I must type manually.. : #!/bin/bash ## Environnement ## LC_ALL=C ## Paths ## rsa_dir="etc/openvpn/easy-rsa"... (10 Replies)
Discussion started by: Arnaudh78
10 Replies

2. AIX

AIX: How to find down who enter a command?

Hi I'm working on AIX. My question: for example, I'm logging in. I enter command "last" and then I know there are 3 people logging in from 3 different IP at the same time, 2 are in the same account. Then someone enters a command. Is there any way to know exactly who ( which IP ) enters... (9 Replies)
Discussion started by: bobochacha29
9 Replies

3. UNIX for Advanced & Expert Users

Need shell script for SMS via telnet command to SMSC directly

I am not very much familiar with telnet based scripting so I would need your help to directly submitting sms as deliver_sm or submit_sm msg to SMSC (IP & system_id and password are already known). So, need your help to provide such script. I previously used such script but my harddisk crashed and... (0 Replies)
Discussion started by: wasay
0 Replies

4. Shell Programming and Scripting

Loop logic, enter into respective IF as per enter input file name

have three big data file, however I just need to see the mentioned below one line form the all the file which has SERVER_CONNECTION Value File 1 export SERVER_CONNECTION=//dvlna002:10001/SmartServer File2 export SERVER_CONNECTION=///SmartServer File3 export... (1 Reply)
Discussion started by: Nsharma3006
1 Replies

5. Red Hat

How to create a command to enter into a dir?

Hi all, I want to create a command for entering into a specific dir. for eg if i want to go to /var/spool/postfix/pid at any point if i enter a command suppose "sp" in the command line it should take me to /var/spool/postfix/pid thanks (2 Replies)
Discussion started by: technoman
2 Replies

6. UNIX and Linux Applications

Running oracle commands Directly from Command Line

In mysql, I can get what I want from a database without having to log into mysql. works great for me and it is perfect. now, i want to be able to do the same in oracle but I dont know how to. For example, if i want to retrieve information from the mysql database from the command line, i issue... (4 Replies)
Discussion started by: SkySmart
4 Replies

7. Shell Programming and Scripting

Enter the command to capture output--help

&& echo "PLEASE enter the command to capture output" || echo "Processing your command manual" x=$# echo $x while do while man $@ | read -r line do >$@.txt ... (1 Reply)
Discussion started by: rrd1986
1 Replies

8. Shell Programming and Scripting

Trapping Enter command !!

Hi I have written a script which works well .. It's divided into a series of jobs one running after another But on pressing the enter key the whole script goes haywire .. I want a way to trap this enter command and echo it as invalid input .. Any suggestions highly appreciated... Thanks :) (2 Replies)
Discussion started by: ultimatix
2 Replies

9. Shell Programming and Scripting

Script 'Enter' Command. Newbie.

Hi, I have the following script which calls a program that asks for user input before progressing. I am new to scripting and this script was written by the previous admin. After $MERGE is executed the application associated with it needs user input - asks for 'Enter' to be pressed. At the... (2 Replies)
Discussion started by: gwhelan
2 Replies

10. Shell Programming and Scripting

How to enter if-then condition on command prompt/line ?

Hi I have some trouble entering if-then condition in a single line on a command prompt in csh. Could someone show how does one do that ? eg: source .cshrc; cd $dir; pwd; test -d $backup_dir; if then mkdir -p ${backup_dir}; echo inside loop; fi; echo outside loop; mv -f... (3 Replies)
Discussion started by: mpc8250
3 Replies
Login or Register to Ask a Question