Sponsored Content
Full Discussion: Problem with X in a script
Top Forums Shell Programming and Scripting Problem with X in a script Post 302523880 by mregine on Friday 20th of May 2011 06:42:59 AM
Old 05-20-2011
Problem with X in a script

Hello,

I'd like to open a bunch of windows on a server/servers from a script using ssh. The point is to run a tool several times (often a quite high number of times) with different parameters, but I'm substituting xeyes for that tool below. I have keys set up to log on transparently onto the server, so I tried:
Code:
#!/bin/bash

for run in `seq 1 10`
do
    ssh -X -l <my user> <server> "xeyes" &
done

However, whenever I run this, I only get a subset of instances of xeyes, anywhere between 1 and (never quite) 10. For all the missing windows, I get an error message:
Code:
Error: Can't open display: localhost:18.0
Error: Can't open display: localhost:20.0
Error: Can't open display: localhost:22.0
Error: Can't open display: localhost:23.0

Therre also seems to be issues with authentication but I don't understand what exactly because I also get a bunch of
Code:
/usr/bin/X11/xauth:  error in locking authority file /home/<user>/.Xauthority
X11 connection rejected because of wrong authentication.

Although I've tried to read up, I don't quite understand what .Xauthority is supposed to do, but I removed (well, renamed .Xauthority.bak) the file in question on the server and tried again, but the errors still occur.

Can someone explain/help/point me to better documentation than I found?
I must admit that I feel like looking for a needle in a haystack when I google the problem because I come up with tons of pages explaining how to set your DISPLAY variable and such, but that doesn't seem to be the problem here, since 1) "ssh -X" should take care of that for me 2) some of the windows are opening.

Again, using X over ssh in general works, just not when I try to start many windows on the server from within a loop. Starting them all by hand with repeated
Code:
$ ssh -X -l <user> <server> "xeyes" &
$ ssh -X -l <user> <server> "xeyes" &
$ ssh -X -l <user> <server> "xeyes" &
$ ssh -X -l <user> <server> "xeyes" &
$ ssh -X -l <user> <server> "xeyes" &
$ ssh -X -l <user> <server> "xeyes" &
$ ssh -X -l <user> <server> "xeyes" &
$ ssh -X -l <user> <server> "xeyes" &
$ ssh -X -l <user> <server> "xeyes" &
$ ssh -X -l <user> <server> "xeyes" &

works fine.

In case this is relevant, I am using Xquartz 2.6.1 on a Mac to connect to a Linux (Ubuntu) box.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problem starting a script from a 'main'-script

Please Help! :o I have a main script (ksh) where another script is called (convert_picture). Normally this works ok, but since some changes has been made on the unix-server (I dont know what :( ) suddenly it doesnt work anymore: i get an error message: ksh: convert_picture not found. I am... (3 Replies)
Discussion started by: Rakker
3 Replies

2. Shell Programming and Scripting

Help. Script problem

hey guys. i have a bunch of programs in a script that needs to run as root and the rest as another user, we'll call him gabriel. now, in this script, i want to run the first few lines as root. now, how do i, after running as root, tell the script to run the remaining lines as the user gabriel?... (3 Replies)
Discussion started by: Terrible
3 Replies

3. Shell Programming and Scripting

ssh script problem problem

Hi Please help me with the following problem with my script. The following block of code is not repeating in the while loop and exiting after searching for first message. input_file ========== host001-01 host001-02 2008-07-23 13:02:04,651 ConnectionFactory - Setting session state... (2 Replies)
Discussion started by: pcjandyala
2 Replies

4. Shell Programming and Scripting

call shell script from perl cgi script problem

hi,, i have perl scipt with line : system('./try.sh $t $d $m'); in shell scipt try.sh i have the line: echo $1 its not printing value of $t that i hav passed..y is it so..i am running it from apache web server (2 Replies)
Discussion started by: raksha.s
2 Replies

5. UNIX for Dummies Questions & Answers

Problem with script

Hello All. I have a script that is suppossed to start up a daemon but when executed, simply hangs. Could you please take a look and let me know where the problem might be? TIA ################################################################### # # SCRIPT: dstart3000.sh # Bring up the Domain... (6 Replies)
Discussion started by: grin1dan
6 Replies

6. Shell Programming and Scripting

Problem with a script

Hi everyone, I got a problem with a script. What it's supposed to do is: to take as arguments a directory name <dir> and a dimension (in byte) <dim>; if <dir> exists, to write name and dimension of every regular file within it that sizes lesser than <dim> in regFileList. Nothing happens... (10 Replies)
Discussion started by: Luke Bonham
10 Replies

7. Shell Programming and Scripting

Problem running a program/script in the background from a script

Hi all, I have a script that calls another program/script, xxx, to run in the background. Supposedly this program at most should finish within five (5) minutes so after five (5) minutes, I run some other steps to run the script into completion. My problem is sometimes the program takes... (5 Replies)
Discussion started by: newbie_01
5 Replies

8. Shell Programming and Scripting

Problem while calling a script within a script

Hi , I have moduled my scripts in three scripts . From First script i am calling second and from second i am calling third for some check . Problem is with the third script call. ---In second script EXP ='test.\abc.\Server.*abc.xml.*' pid=$($HOME/bin/checkpid $EXP) --Third... (2 Replies)
Discussion started by: amrishn
2 Replies

9. Shell Programming and Scripting

Shell script newbie, what is problem with my script?

Hello, Ubuntu server 11.10 can anybody help what is problem with my shell script? #!/bin/bash #script to find out currently logged on user is root or not. if ] then echo "You are super" else echo "You are awesome!" fi When I run script, I get following output ./uid: line 3: I... (4 Replies)
Discussion started by: kaustubh
4 Replies

10. Shell Programming and Scripting

Problem in calling a script inside a script

Hi team, I have a script in different folder. Now i want to call that script and execute that script from that path alone. My code is #!/bin/bash wname=yahoo PATH='/opt/IBM' wac=`/usr/bin/ls $PATH | /usr/bin/grep "$wname"` STOP=`/usr/bin/find $PATH/$wac -type f -name "stop.sh"`... (8 Replies)
Discussion started by: natraj005
8 Replies
SSH-KEYSIGN(8)						    BSD System Manager's Manual 					    SSH-KEYSIGN(8)

NAME
ssh-keysign -- ssh helper program for host-based authentication SYNOPSIS
ssh-keysign DESCRIPTION
ssh-keysign is used by ssh(1) to access the local host keys and generate the digital signature required during host-based authentication with SSH protocol version 2. ssh-keysign is disabled by default and can only be enabled in the global client configuration file /etc/ssh/ssh_config by setting EnableSSHKeysign to ``yes''. ssh-keysign is not intended to be invoked by the user, but from ssh(1). See ssh(1) and sshd(8) for more information about host-based authen- tication. FILES
/etc/ssh/ssh_config Controls whether ssh-keysign is enabled. /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_rsa_key These files contain the private parts of the host keys used to generate the digital signature. They should be owned by root, read- able only by root, and not accessible to others. Since they are readable only by root, ssh-keysign must be set-uid root if host- based authentication is used. Note that ssh-keysign is not set-uid by default on Mac OS X. /etc/ssh/ssh_host_dsa_key-cert.pub /etc/ssh/ssh_host_ecdsa_key-cert.pub /etc/ssh/ssh_host_rsa_key-cert.pub If these files exist they are assumed to contain public certificate information corresponding with the private keys above. SEE ALSO
ssh(1), ssh-keygen(1), ssh_config(5), sshd(8) HISTORY
ssh-keysign first appeared in OpenBSD 3.2. AUTHORS
Markus Friedl <markus@openbsd.org> BSD
August 31, 2010 BSD
All times are GMT -4. The time now is 07:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy