Sponsored Content
Operating Systems AIX ssh public key setup questions. Post 302366470 by haroon_a on Thursday 29th of October 2009 02:32:25 PM
Old 10-29-2009
Quote:
Originally Posted by garethr
In the shell script, printThisWord () {...} needs to come before you first try to call printThisWord.

On the ssh side, you can run commands remotely as follows:
Code:
ssh user@remotehost "df -k ; ls /"


Thanks you. It worked, when I moved the function before its call.

I have another question:

I want to cancatenate value of some variables, and pass it to another functin. i.e.
Code:
aFunction() {
echo "$1"
}
 
msg1="some message\n"
msg2="some other message\n"
msg3="even some more message\n"
 
msgs="$msg1 $msg2 $msg3"
 
aFunction $msgs

But when I run my script, the output is only the first line, rather the first word. I guess it does it because $1 is for the first argument, and hence it only takes "some" in this case.

Can someone tell me how to pass value of $msgs which is 3 lines into a function and read the entire value (3 lines) from within my function?

Thanks,


Please advise...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SSH Public key method

do we need root access for the remote server to ssh without a password(i.e by using id_rsa.pub method)??? (1 Reply)
Discussion started by: roshanjain2
1 Replies

2. UNIX for Advanced & Expert Users

SSH - Public key

When should one have to generate a public key on a Server when the public key is already created and used by other clients? Thanks, Rahul. (6 Replies)
Discussion started by: rahulrathod
6 Replies

3. UNIX for Advanced & Expert Users

Setting Up public key on Windows for ssh/scp

Hi, I am trying to scp a file from our Unix server to the local Windows machine.I have created the key pair in Unix server using ssh-keygen command in unix. But I am not sure where can we put the public key(generated on Unix) in Windows machine so that scp from Unix machine to Windows is... (3 Replies)
Discussion started by: dennis.jacob
3 Replies

4. Shell Programming and Scripting

Generate Public Key when the server is not ssh enabled

I am writing a script that needs to access various servers some of which are not ssh enabled. In order to access the ssh enabled servers I am using the following command to generate the public key : ssh-keygen -t rsa Is there a similar command for the other servers as well. If I try to use... (1 Reply)
Discussion started by: ravneet123
1 Replies

5. UNIX for Advanced & Expert Users

Generate Public key for non ssh enabled servers

I am writing a script that needs to access various servers some of which are not ssh enabled. In order to access the ssh enabled servers I am using the following command to generate the public key : ssh-keygen -t rsa Is there a similar command for the other servers as well. If I try to use... (1 Reply)
Discussion started by: ravneet123
1 Replies

6. Red Hat

SSH Public key Authentication Issue

Hi All; I have an issue with password less authentication via ssh ( v2) I have two servers Server A and Server B, following are the server details Server A OS - HP UX B.11.11 U 9000/800 SSH - OpenSSH_4.3p2-hpn, OpenSSL 0.9.7i 14 Oct 2005 HP-UX Secure Shell-A.04.30.000, HP-UX... (3 Replies)
Discussion started by: maverick_here
3 Replies

7. Solaris

Solaris 8 ssh public key authentication issue - Server refused our key

Hi, I've used the following way to set ssh public key authentication and it is working fine on Solaris 10, RedHat Linux and SuSE Linux servers without any problem. But I got error 'Server refused our key' on Solaris 8 system. Solaris 8 uses SSH2 too. Why? Please help. Thanks. ... (1 Reply)
Discussion started by: aixlover
1 Replies

8. UNIX for Dummies Questions & Answers

how to create a public/private key using ssh-keygen

Hi, please guide me create a public/private key using ssh-keygen, lets say I have been access to server named pngpcdb1with a userid and password ...!!! and also please explain in detail the concept of these keys and ssh as I was planning to use them in ftp related scripts..! Thanks in... (1 Reply)
Discussion started by: rahul125
1 Replies

9. UNIX for Advanced & Expert Users

SSH public key failing without error message

My password-free ssh connection has worked in the past but has stopped working and I can't get it going again. The files in .ssh on both source and target are set to 600: drwx------ 2 ingres 1024 Mar 2 13:57 . drwxr-xr-x 25 ingres 2048 Mar 29 09:38 .. -rw------- 1 ingres ... (9 Replies)
Discussion started by: Catullus
9 Replies

10. Solaris

Public private key setup issue in Solaris 10

Hi i am using solaris 10.I am trying to setup a public/private key but it is not working.Appreciate your repsonse on it There are two servers DB1 server and DB2 server. 1)I have generated public/private key using below step on both servers. ssh-keygen -t rsa 2)From DB1 server moved the... (6 Replies)
Discussion started by: muraliinfy04
6 Replies
SENDMMSG(2)						     Linux Programmer's Manual						       SENDMMSG(2)

NAME
sendmmsg - send multiple messages on a socket SYNOPSIS
#define _GNU_SOURCE #include <sys/socket.h> int sendmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int flags); DESCRIPTION
The sendmmsg() system call is an extension of sendmsg(2) that allows the caller to transmit multiple messages on a socket using a single system call. (This has performance benefits for some applications.) The sockfd argument is the file descriptor of the socket on which data is to be transmitted. The msgvec argument is a pointer to an array of mmsghdr structures. The size of this array is specified in vlen. The mmsghdr structure is defined in <sys/socket.h> as: struct mmsghdr { struct msghdr msg_hdr; /* Message header */ unsigned int msg_len; /* Number of bytes transmitted */ }; The msg_hdr field is a msghdr structure, as described in sendmsg(2). The msg_len field is used to return the number of bytes sent from the message in msg_hdr (i.e., the same as the return value from a single sendmsg(2) call). The flags argument contains flags ORed together. The flags are the same as for sendmsg(2). A blocking sendmmsg() call blocks until vlen messages have been sent. A nonblocking call sends as many messages as possible (up to the limit specified by vlen) and returns immediately. On return from sendmmsg(), the msg_len fields of successive elements of msgvec are updated to contain the number of bytes transmitted from the corresponding msg_hdr. The return value of the call indicates the number of elements of msgvec that have been updated. RETURN VALUE
On success, sendmmsg() returns the number of messages sent from msgvec; if this is less than vlen, the caller can retry with a further sendmmsg() call to send the remaining messages. On error, -1 is returned, and errno is set to indicate the error. ERRORS
Errors are as for sendmsg(2). An error is returned only if no datagrams could be sent. VERSIONS
The sendmmsg() system call was added in Linux 3.0. Support in glibc was added in version 2.14. CONFORMING TO
sendmmsg() is Linux-specific. NOTES
The value specified in vlen is capped to UIO_MAXIOV(1024). EXAMPLE
The example below uses sendmmsg() to send onetwo and three in two distinct UDP datagrams using one system call. The contents of the first datagram originates from a pair of buffers. #define _GNU_SOURCE #include <netinet/ip.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> int main(void) { int sockfd; struct sockaddr_in sa; struct mmsghdr msg[2]; struct iovec msg1[2], msg2; int retval; sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd == -1) { perror("socket()"); exit(EXIT_FAILURE); } sa.sin_family = AF_INET; sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); sa.sin_port = htons(1234); if (connect(sockfd, (struct sockaddr *) &sa, sizeof(sa)) == -1) { perror("connect()"); exit(EXIT_FAILURE); } memset(msg1, 0, sizeof(msg1)); msg1[0].iov_base = "one"; msg1[0].iov_len = 3; msg1[1].iov_base = "two"; msg1[1].iov_len = 3; memset(&msg2, 0, sizeof(msg2)); msg2.iov_base = "three"; msg2.iov_len = 5; memset(msg, 0, sizeof(msg)); msg[0].msg_hdr.msg_iov = msg1; msg[0].msg_hdr.msg_iovlen = 2; msg[1].msg_hdr.msg_iov = &msg2; msg[1].msg_hdr.msg_iovlen = 1; retval = sendmmsg(sockfd, msg, 2, 0); if (retval == -1) perror("sendmmsg()"); else printf("%d messages sent ", retval); exit(0); } SEE ALSO
recvmmsg(2), sendmsg(2), socket(2), socket(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2012-12-16 SENDMMSG(2)
All times are GMT -4. The time now is 06:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy