Im running into something that I cant seem to find an answer to. I have a script and it does the following set of actions -
1. Cd to one specific directory
2. Look for all the files that contain a string and once a occurence of the string is found,
3. Pipe that output to awk as input and print $3.
Upto this point, I was able to do it without any issue and the script runs well.
Now, here comes the challenge. I need to run the above script on more than one machine and I just don't know how to do it.
Im sure there must be many folks out there who must be doing this on a daily basis.
Here are the following steps that I undertook
Method 1 :
1. I generated a public & private key pair and I did happen to add authroized_keys file with the contents of id_rsa.pub and they both have the same size.
2. After the above step, I ran this, ssh user@machine and strangely enough, it asks for my password AGAIN ! So, I enter that one more time assuming that I didnt correlate my userid/password combo with the machine that Im connecting to.
3. So, I try to connect to the machine again by keying ssh user@machien & it only lets me in if I entered the correct password...not the key value that I entered. This lets me believe that generating the public & private keys is not in any shape or form easing the situation.
Method 2:
When I run the above lines, it throws the following errors -
This makes me believe that it is not the right path that I should undertake.
Also, when I do this, "ssh user@machine ls " and after entering password, it is showing me all of the contents on machine without any issue.
Now, the admin is out of town and I honestly have no clue what Im doing other than googling stuff out and if I need any help, there is offshore but getting any real help is pretty much an exercise in pulling teeth out.
Any and all help is greatly appreciated & will be cherished.
regards,
Lee.
Last edited by Franklin52; 02-22-2011 at 04:54 AM..
Reason: Please use code tags, thank you
1. I generated a public & private key pair and I did happen to add authroized_keys file with the contents of id_rsa.pub and they both have the same size.
2. After the above step, I ran this, ssh user@machine and strangely enough, it asks for my password AGAIN !
I would like to know:
1.1. Which OS are you using: local/remote.
1.2. What are the permissions of the .ssh directory and the .ssh/authorized_keys file.
Could you post the output of the following command:
Agree with radoulov. First you need to generate keys to make your ssh passwordless across machines. Once you are done with this then you can write a script that does ssh to different machines and perform certain actions.
Here are the answer to your questions. Still I havent made any progress on this.
Please advise !
regards,
Lee.
1.1. Which OS are you using: local/remote.
MAC OSX 10.6
1.2. What are the permissions of the .ssh directory and the .ssh/authorized_keys file.
see above.
Last edited by radoulov; 02-22-2011 at 03:52 PM..
Reason: Code tags, please!
After fiddling/googling for couple of hours, here is where I am. I ran the following script, with parameters, "ls -ltr", it shows me the list of files & directories on the remote machine.
Now, the question is, how do I do more than this ? i.e. the following,
1. Cd to one specific directory
2. Look for all the files that contain a string and once a occurence of the string is found,
3. Pipe that output to awk as input and print $3.
I tried this
and it is throwing the following error
How should I run the original script now ?
Please advise !
regards,
Lee.
---------- Post updated at 03:10 PM ---------- Previous update was at 03:04 PM ----------
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Hi All,
I'm completely new to bash scripting and still learning my way through albeit vey slowly.
I need to know where to insert my server names', my ip address numbers through out the script alas to no avail.
I'm also searching on how to save .sh (bash shell) script properly.... (25 Replies)
Please can you help me understand the significance of providing arguments under sh -s in
> ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh (4 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
hi
in my application there is a line with
open(/dev/mydevice,0);
it work good when it run manually,
but when try to run it within script
///////////////////////////////////////////
#!/bin/sh
./device_test 0 0 0 1 1 1 0 0 1
/////////////////////////////////////////
I receive 'Failed... (3 Replies)
Hi,
For my bash script, terminal with bash is generate an OK output and program works right.
already,
terminal with ash have "line 48: syntax error: Bad substitution" output and program don't work.
:confused: (0 Replies)
heya,
can someone help me with following problem.
i am not sure how far you know the catalina.sh script from tomcat. when i start my tomcat with "catalina.sh run" then the startup-process-output will be printed out on the console, but the tomcat process is started in current shell/session, so... (1 Reply)
Hello All.
I'm get the following messages posted to the /var/adm/syslog file ever second and not sure on how to stop the process.
May 14 15:50:52 a3360 bootpgw: version 2.3.5
May 14 15:50:52 a3360 inetd: /etc/bootpgw exit 0x1
As said about this gets logged every second only thing that... (4 Replies)