10-23-2014
Note that ssh is running a shell on the remote end, so the rules are most likely bash or ksh as sh does not do [[]], but not ssh. I guess 'ssh' as 'secure shell' is a misnomer, since it is not a shell but a remote execution tool.
9 More Discussions You Might Find Interesting
1. Solaris
I've script where i check connection to many hosts ... it take input from HOSTLIST.txt
Ex. cat HOSTLIST.txt
host1
host2
while read HOSTNAME
do
echo $HOSTNAME
ssh -o "BatchMode=yes" ${HOSTNAME} "echo 2>&1" $$ echo flag=0 || flag=1;
if ; then
echo "No SSH... (3 Replies)
Discussion started by: prash184u
3 Replies
2. Shell Programming and Scripting
I am using Net::SSH::Expect to connect to the device(iLO) with SSH. After the $ssh->login() I'm able to view the prompt, but not able to send any coommands.
With the putty I can connect to the device and execute the commands without any issues.
Here is the sample script
my $ssh =... (0 Replies)
Discussion started by: hansini
0 Replies
3. UNIX for Advanced & Expert Users
Hi guys!
I'm working on a little script. I have a txtfile with several hosts, Unix team has copied my keys into several of those servers, but not all of them, I need to figure out which ones I don't have access to, (I want a list of servers I don't have access to, so I can request for it). This... (1 Reply)
Discussion started by: erick_tuk
1 Replies
4. Shell Programming and Scripting
Hi
#Testing for file existence
if ; then
echo 'SCHOOL data is available for processing'
else
echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING'
:
i wrote a script, where it begins by checking if file exists or not.
If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies
5. Shell Programming and Scripting
Hi everyone,
I am trying to figure out a way to ssh to remote server and check if file exists, and if it doesn't I want to leave the script with an exit status of 5.
I have the following that I am attempting to use, but it is not returning anything:
check()
{
ssh ${SOURCE_SERV} "ls -l... (4 Replies)
Discussion started by: jimbojames
4 Replies
6. Shell Programming and Scripting
Hi All,
I am facing a problem while checking for existence of file over ssh !
Basically, i want to ssh and check if file exists.. If file exists return 1. If file does not exits return 0 (or any value)
I am using the below code
file_avail=`ssh username@host "if ]; then exit 1;... (10 Replies)
Discussion started by: galaxy_rocky
10 Replies
7. UNIX for Beginners Questions & Answers
Hi,
I want to validate ssh connection one after one for multiple servers..... password less keys already setup but now i want to validate if ssh is working fine or not...
I have .sh script like below and i have servers.txt contains all the list of servers
#/bin/bash
for host in $(cat... (3 Replies)
Discussion started by: sreeram4
3 Replies
8. UNIX for Beginners Questions & Answers
Hi there,
I am sorry to ask that kind of beginner thing, but all the code I found online didnt work for me.
All I want to do is: Check via SSH if a File exists on my webserver. The SSH login has to be with username and password.
So I would be very thankful if somebody could write the line.... (8 Replies)
Discussion started by: Jens885544
8 Replies
9. Shell Programming and Scripting
Hi,
i want use this Comand for my psql request
sh ssh -o StrictHostKeyChecking=no rootatemailaddress.de sudo psql -U postgres -c "select pg_terminate_backend(pid) from pg_stat_activity where datnam=\'$DB\';"'"
but the shell lost the inverted comma for datnam=\'$DB\'. The request deliver... (2 Replies)
Discussion started by: peterpane007
2 Replies
LEARN ABOUT OPENSOLARIS
ssh-agent
ssh-agent(1) User Commands ssh-agent(1)
NAME
ssh-agent - authentication agent
SYNOPSIS
ssh-agent [-a bind_address] [-c | -s ] [-d]
[command [args]...]
ssh-agent [-c | -s] -k
DESCRIPTION
ssh-agent is a program to hold private keys used for public key authentication (RSA, DSA). ssh-agent is often started at the beginning of a
login session. All other windows or programs are started as clients to the ssh-agent program. Through use of environment variables, the
agent can be located and automatically used for authentication when logging in to other machines using ssh(1). See the System Administra-
tion Guide: Security Services.
If a command line is given, this is executed as a subprocess of the agent. When the command dies, so does the agent.
The agent initially does not have any private keys. Keys are added using ssh-add(1), which sends the identity to the agent. Several identi-
ties can be stored in the agent; the agent can automatically use any of these identities. Use the -l option in ssh-add(1) to display the
identities currently held by the agent.
The agent is run in the user's local host. Authentication data need not be stored on any other machine, and authentication passphrases
never go over the network. However, if the connection to the agent is forwarded over SSH remote logins, the user can use the privileges
given by the identities anywhere in the network in a secure way.
There are two main ways to get an agent setup. Either you let the agent start a new subcommand into which some environment variables are
exported, or you let the agent print the needed shell commands (either sh(1) or csh(1) syntax can be generated) which can be evalled in the
calling shell. Later, use ssh(1) to look at these variables and use them to establish a connection to the agent.
A unix-domain socket is created (/tmp/ssh-XXXXXXXX/agent.pid) and the name of this socket is stored in the SSH_AUTH_SOCK environment vari-
able. The socket is made accessible only to the current user. This method is easily abused by root or another instance of the same user.
The SSH_AGENT_PID environment variable holds the agent's PID.
The agent exits automatically when the command given on the command line terminates.
OPTIONS
The following options are supported:
-a bind_address Binds the agent to the unix-domain socket bind_address. The default is /tmp/ssh-XXXXXXXX/agent.pid.
-c Generates C-shell commands on stdout. This is the default if SHELL indicates that it is a csh style of shell.
-d Debug mode. When this option is specified, ssh-agent will not fork.
-k Kills the current agent (given by the SSH_AGENT_PID environment variable).
-s Generates Bourne shell commands on stdout. This is the default if SHELL does not indicate that it is a csh style of
shell.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
1 An error occurred.
FILES
/tmp/ssh-XXXXXXXX/agent.pid
Unix-domain sockets used to contain the connection to the authentication agent. These sockets should only be readable by the owner. The
sockets are removed when the agent exits.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWsshu |
+-----------------------------+-----------------------------+
|Interface Stability |Committed |
+-----------------------------+-----------------------------+
SEE ALSO
ssh(1), ssh-add(1), ssh-keygen(1), sshd(1M), attributes(5)
System Administration Guide: Security Services
SunOS 5.11 17 Nov 2008 ssh-agent(1)