Establishing remote connection to a Xserver from a UNIX Box


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Establishing remote connection to a Xserver from a UNIX Box
# 1  
Old 11-21-2013
Establishing remote connection to a Xserver from a UNIX Box

Hello Guys ,

I have been working on a script where we are looking to connect a remote Xserver from a Unix box. Once a connection is made , i need to run several commands on remote machine to check various stuffs.

As per my knowledge on unix (which is like a drop in ocean) , i found SSH as a best option for doing my task as it allows freely to run any command on remote machine . I declined using ftp or sftp , as these connections do not satisfy my needs i.e running commands like "kill, ps, sed , grep etc". I considered telnet but server do not supports it.

I frankly cannot thing of any other best option then SSH.

I tried implementing SSH in my shell script , but got stuck when on password step. I had no idea to overcome this password thing automatically in my shell script. After googling a lot , i found options like sshpass, scp, spawn and others utilities , but none of them works at my unix server.I don't have options to use RSA here.

i am looking for some solution so i can use SSH in my script and pass the password and then log in to remote machine .

Also if u guys have better solution then SSH , it will always be welcomed.

Looking forward for expert's help.

Cheers !!!!!!!!Smilie
# 2  
Old 11-21-2013
Try using the ssh keyed-access mechanism. You generate a key pair with ssh-keygen as part of this mechinism. See the man pages.
# 3  
Old 11-21-2013
thanks for ur comments.

But as i have mentioned before , i am not authorised to use keygen here. Also i have list of X servers which i will be login to and even if i get keygen done , i have to form a RSA , copy it to remote machine and then use ssh in my script.

Just like below :

Code:
Step 1: Create public and private keys using ssh-key-gen on local-host

jsmith@local-host$ [Note: You are on local-host here]

jsmith@local-host$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/jsmith/.ssh/id_rsa.
Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub.
The key fingerprint is:
33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 jsmith@local-host
Step 2: Copy the public key to remote-host using ssh-copy-id

jsmith@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
jsmith@remote-host's password:
Now try logging into the machine, with "ssh 'remote-host'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.
Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.

Step 3: Login to remote-host without entering the password

jsmith@local-host$ ssh remote-host
Last login: Sun Nov 16 17:22:33 2008 from 192.168.1.2
[Note: SSH did not ask for password.]

jsmith@remote-host$ [Note: You are on remote-host here]

# 4  
Old 11-21-2013
oh, can't used key'ed access, use expect to pass password.
# 5  
Old 11-21-2013
Quote:
Originally Posted by blackrageous
oh, can't used key'ed access, use expect to pass password.
If he's not even allowed to use keygen, his administrators will be livid to find someone circumventing it with the expect brute-forcing tool.
# 6  
Old 11-21-2013
i have no idea about "expect ". Hw do i use it ?

Or is there no other way through scripting , that i can pass password to console ?

Regards,
Himanshu Sood
# 7  
Old 11-21-2013
"interactive password authentication" means "password typed by a human being in realtime authentication" and nothing else will do. It insists on a password typed into a terminal, not a file, not a pipe. You literally have to fool it with a brute-forcing tool like expect to make it believe its coming from a terminal.

But if you're not even allowed to use safe and secure keys, your administrators will be absolutely livid to discover you using an unsafe, insecure expect kludge instead.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Sftp connection not establishing from Linux to DataPower

Hi Everyone, I am trying to send files from Linux to DataPower server using public key based authentication but it's not working as expected and every-time password expecting for sftp transfer. Can someone please help on this? Steps I fallowed: Created keys pair at source server... (4 Replies)
Discussion started by: renukeswar
4 Replies

2. Programming

Remote login UNIX box from java passing parameters to the custom script called in the profile

Hello Good Day / Guten Tag.... I have to login the server and the user profile contains some scripts which need the inputs to be taken from the keyboard. So I use the method to conn.authenticateWithKeyboardInteractive(username, new InteractiveCallback() { public String... (1 Reply)
Discussion started by: Sanalkumaran
1 Replies

3. Shell Programming and Scripting

Notify when the script run(hourly)on my jump-box only when there is a failure on my remote-box

Team, Presently I have a script, which i have set up cron on one of my Jump-boxes,and gives me the output on every hourly basis,fetching the data from the remote machine.Basically it gives me the list of all active users logged and its count once we execute the script.Here the count is... (6 Replies)
Discussion started by: whizkidash
6 Replies

4. Ubuntu

establishing connection with e-kermit running on LINUX from my operating system

we designed a primitive operating system for learning basics fundamentals and we created process switching, interrupt/polled IO for device drivers like UART and printers. We accomplish this by using our own tools called SPEDE (for downloading compiled elf image from host ubuntu system that have... (0 Replies)
Discussion started by: bicepjai
0 Replies

5. Linux

How to find remote Linux box login account without login in to that box?

Hi, How to find remote Linux box login account without login in to that box? I don't have login account at my remote Linux box. But I need who are all having login account. How do I findout? Thanks, --Muthu. (3 Replies)
Discussion started by: Muthuselvan
3 Replies

6. SuSE

NoMachine NX window closes after establishing connection

Hi, I am trying to use nomachine nx server and client. But somehow it doen't work. What happens is the following: 1.- Client starts up 2.- Client authenticates with Server 3.- The NoMachine window appears for 2-4 seconds 4.- The NoMachine window exists Somehow a "closeEvent" is sent.... (3 Replies)
Discussion started by: blackicecube
3 Replies

7. UNIX for Advanced & Expert Users

"Connection closed by remote host" while doing ssh to a solaris box

Hi All, When i try to do ssh from a linux to solaris box its throughing "Connection closed by remote host". Please not that this error is not occuring every time i do ssh, it occurs at random timing( Mostly ssh is successful) - unfortunately my script which is doing ssh is falling at this time... (4 Replies)
Discussion started by: pkumar7
4 Replies

8. Shell Programming and Scripting

Problem establishing Connection on the LAN

Hi everybody i need your help on this I have LAN which run Sun microsystem with solaris 7 OS on each of the servers. The LAN was working fine before an interruption of power supply which makes servers to operating as standalone servers. i.e none of the servers have access to one another. How do i... (2 Replies)
Discussion started by: sbmada
2 Replies

9. UNIX for Dummies Questions & Answers

Copy file from Remote Unix box to windows machine

Hi I need to copy a file from the remote unix server to windows machine. I read lot of thrad but didn't worked out. Requesting all to please help. (2 Replies)
Discussion started by: sameerspice
2 Replies

10. UNIX for Dummies Questions & Answers

Running UNIX commands remotely in Windows box from Unix box – avoid entering password

I am able to run the UNIX commands in a Windows box from a UNIX box through "SSH" functionality. But whenever the SSH connection is established between UNIX and Windows, password for windows box is being asked. Is there a way to avoid asking password whenever the SSH connection is made? Can I... (1 Reply)
Discussion started by: D.kalpana
1 Replies
Login or Register to Ask a Question