Tagged Questions
-1
votes
0answers
50 views
How to touch a multifile using ssh? [closed]
I am trying to touch a file to another server as follows:
ssh [user]@[server] '. /abinitio/apps30/abinitio30.env m_touch path_to_mfs way'
It is giving error as:
Cannot create recovery file in ...
1
vote
0answers
61 views
Using sshpass, return code (exit status) differs for reasons unknown using valid commands
There are a few things going on here but I think ultimately, either CLish or SSH is returning an exit code that is messing up my work flow.
I'm attempting to connect to a remote machine (CLish shell) ...
1
vote
1answer
103 views
How to ssh on multiple ipaddress and get the output and error on the local *nix machine?
command="ls -lrt;uname -a;uname -o"
for i in 10.38.227.229 10.38.164.103
do
ssh auto21@$i "$command 2>&1" >> log
#ssh -n auto21@$i "$command" 2> >> log
done
i am trying ...
2
votes
1answer
308 views
SSH causes while loop to stop
I have finally managed to boil down a problem I have been struggling with for a few weeks. I use SSH with "authorized keys" to run commands remotely. All is fine except when I do it in a while loop. ...
4
votes
2answers
106 views
Is it possible to store ssh connection in bash script instead of $(ssh user@ip command) every time?
I think that the code that I already have is not very efficient as it has to connect each time to the same machine and execute a command. Code:
tmp=$(ssh -nq $USER@$IP "$COMMAND" 2>> $LOG)
...
3
votes
2answers
1k views
Executing a shell script from remote server on local machine
Imagine a shell script on the remote server as
#!/bin/bash
rm /test.x
How can I (if possible) to execute this script from my local machine to delete /test.x file on my local machine. Obviously, the ...
3
votes
3answers
113 views
SSH to two addresses, use the one that connects first
I have a home computer (let’s call it franklin because that’s what I call it) that I often ssh into from my work laptop. When I’m at home, I ssh to franklin.local, and when I’m at work or anywhere ...
5
votes
3answers
2k views
ssh input from text file
These two question is driving me crazy and I don't have good expertise of ssh. (but I suspect it is to do with redirection only)
The questions are,
You want to pass multiple lines of input from a ...
2
votes
3answers
502 views
Run if statement on remote machine
I'm trying to run a set of commands on a remote machine, that includes an if statement. I'm using this to shutdown a list of kvm instances. The first line should be fine, but could be prettier, rest ...
1
vote
1answer
10k views
How do I execute a remote shell script over SSH and be prompted for passwords by commands that require it in that script?
I want to do something like this
ssh [email protected] ./remote_script.sh
Contents of remote_script.sh
#!/bin/bash
hg pull
This example is much simpler than what I am actually doing. I know ...
1
vote
3answers
439 views
Execute a command on multiple hosts, but only print command if it is successful?
Here's what I want to do.
I want to check over 100 hosts and see if a file exists on that host. If the file does exist, then I want to print the hostname and the output of the command.
In this ...
2
votes
1answer
379 views
How to script a database migration using SSH?
I am trying to create a sync.sh script that coordinates with our less-than-ideal version control for our website. This script will migrate a copy of the live database to our local development ...
5
votes
3answers
6k views
How to write a bash script, that logs onto an other machine to do stuff?
Is it possible to write a bash script, that
would be started from machine A, logs in on a different machine B by ssh (both machines A and B would be Linux-Machines),
copys some files on to machine B
...
1
vote
2answers
342 views
How to change user with authentication inside shell script
It is possible to change the user within a shell script by su - newuser; but what if the newuser needs authentication. How can I provide the password within the shell script?
None of the users is ...
0
votes
2answers
380 views
Automated SSH Login [duplicate]
Possible Duplicate:
Shell Script for logging into a ssh server
Autentification on SSH connection in OneLine
How could I make a SSH Login programmatically on a unix server, I don't have ...