Sponsored Content
Full Discussion: Running command using SSH
Top Forums Shell Programming and Scripting Running command using SSH Post 302827101 by Just Ice on Friday 28th of June 2013 12:47:45 AM
Old 06-28-2013
your issue is that the script is checking for the directories on the local server ...
Code:
ssh -n user@host "hostname;[ -d /opt/shared -a -w /opt/shared/data/jms ] && echo 'JMS mounts exist' || echo 'JMS mounts do not exist'" >> OutputResult.txt

This User Gave Thanks to Just Ice For This Post:
 

10 More Discussions You Might Find Interesting

1. Cybersecurity

running NIS over ssh

Hi Guys, Is it possible to run NIS over ssh as I want to run NIS without the security risks that would normally follow? If you have got any suggestions please share them with me. Andy H (2 Replies)
Discussion started by: Andy Hibbins
2 Replies

2. Shell Programming and Scripting

is running this command via ssh possible? (formatting issues)

Here is the command I want to run: for pkg in `pkginfo | grep -i VRTS | awk '{print $2}'`; do showrev -p | grep $pkg; done | awk '{print $2 "\t" $7}' | uniq It returns the package info in a form such as: 113210-03 VRTSfspro 112392-06 VRTSvmman 113596-03 VRTSvmpro... (1 Reply)
Discussion started by: LordJezo
1 Replies

3. Shell Programming and Scripting

Cron job giving error while running SSH command

Hi All, The script which i am using to SSH to remote server is working fine when i run is using ./ but when cron runs it it gives error that "ssh: not found" please help!!! (3 Replies)
Discussion started by: visingha
3 Replies

4. Shell Programming and Scripting

ssh running on function

i have a problem regarding running an ssh command while inside "function" script structure #!/usr/bin/bash func1(){ script=$1 ssh user@server "$script" } cat script.txt | while read line do func1 $line done exit 0 the problem is when ssh ran,... (1 Reply)
Discussion started by: ryandegreat25
1 Replies

5. Shell Programming and Scripting

Running script and commands through SSH

Hello All, I am trying to run some simulations through SSH from my mac on our university SOLARIS system. My problem is that whenever I want to execute a command I get an error which says "Invalid argument". Maybe I should explain more what I want to do and what I did. Firstly I installed a... (10 Replies)
Discussion started by: Apfik
10 Replies

6. Shell Programming and Scripting

ssh - running remote command not exiting

Hi, i have a shellscript, where in i need to connect to different server start these three jobs and exit from the server and start the same three jobs on local server. ssh user@remotehost 'bash -s' << EOF ${GETT_HOME}/bin/start1 & sleep 10 ${GETT_HOME}/bin/start2 & sleep 10... (1 Reply)
Discussion started by: swapnabhargav
1 Replies

7. UNIX for Dummies Questions & Answers

Sudo ssh with command running in background

I am trying to run a command. This is one of my attempts: for i in fileservera; do ssh -t $i 'sudo ls /';doneThis works, and I see the directories. However, what I want to do now is start a process on the remote server such as /usr/bin/connectproc -standalonesudo /usr/bin/connectproc... (1 Reply)
Discussion started by: newbie2010
1 Replies

8. Shell Programming and Scripting

Running test command in ssh

I tried to run the following commands in my shell script. This command works fine for me: ssh -n "${username}"@"${hostname}" "grep WARNING ${serverhome}/${serverlog} | wc -l" The result is: 1548 However when i try to run a similar one: ssh -n "${username}"@"${hostname}" "test `grep -q... (2 Replies)
Discussion started by: hys1117
2 Replies

9. UNIX for Dummies Questions & Answers

Script still running after ssh

I have the lines below on my script: script.ksh: case `hostname` in some_host) ssh server1A "/home/script.ksh $1 $2" ssh server1B "/home/script.ksh $1 $2" ssh server1C "/home/script.ksh $1 $2" ssh server1D "/home/script.ksh $1 $2" ssh... (1 Reply)
Discussion started by: erin00
1 Replies

10. Shell Programming and Scripting

Issue with running a script via ssh

Hi, I'm trying to run a user defined shell script with options and arguments via ssh but getting error as ksh: Script.sh: not found. Here is what i'm running: ssh -t username@server 'cd /path/to/script; script.sh -t start here '-t' with script.sh, is an user defined option and 'start' is also... (3 Replies)
Discussion started by: xsam
3 Replies
SSH-COPY-ID(1)						      General Commands Manual						    SSH-COPY-ID(1)

NAME
ssh-copy-id - install your public key in a remote machine's authorized_keys SYNOPSIS
ssh-copy-id [-i [identity_file]] [user@]machine DESCRIPTION
ssh-copy-id is a script that uses ssh to log into a remote machine (presumably using a login password, so password authentication should be enabled, unless you've done some clever use of multiple identities) It also changes the permissions of the remote user's home, ~/.ssh, and ~/.ssh/authorized_keys to remove group writability (which would oth- erwise prevent you from logging in, if the remote sshd has StrictModes set in its configuration). If the -i option is given then the identity file (defaults to ~/.ssh/id_rsa.pub) is used, regardless of whether there are any keys in your ssh-agent. Otherwise, if this: ssh-add -L provides any output, it uses that in preference to the identity file. If the -i option is used, or the ssh-add produced no output, then it uses the contents of the identity file. Once it has one or more fin- gerprints (by whatever means) it uses ssh to append them to ~/.ssh/authorized_keys on the remote machine (creating the file, and directory, if necessary) SEE ALSO
ssh(1), ssh-agent(1), sshd(8) OpenSSH 14 November 1999 SSH-COPY-ID(1)
All times are GMT -4. The time now is 11:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy