I would like to scp multiple files to a remote server that requires a password for the process to be completed.
I have 30 folders (x_1, x_2 ... x_30), each containing 25 files. What I want to do is scp 1 out of the 25 files (file called bvals) for all my folders to a remote server and place each file to its respective folder (x_1, x_2 ... x_30 in the remote server).
I wrote this script:
The problem with this script (of course) is that every time n takes a new argument (x_1 etc) I am asked to insert my password.
Is there any way to write this script in a way such that I am prompted to write my password only once?
Thank you!
Moderator's Comments:
Please use CODE tags (as required by the forum rules you agreed to when you joined this the UNIX & Linux Forums) when displaying sample input, sample output, and code segments.
Last edited by Don Cragun; 02-18-2017 at 09:37 PM..
Reason: Add CODE and ICODE tags.
Hi,
I am facing a weired problem in my FTP script. I want to transfer multiple files from remote server to local server everyday, using mget * in my script. I also, want to send an email for successful or failed FTP. My script works for file transfer, but it don't send any mail. There is... (2 Replies)
Hi ,
I am doing SCP for copying log files from different server(around 24 server)
I need to copy these bulk logfiles every 15 min.
How can i do multiple SCP at the same time?
My current code is like this
scp $CUSTCARE_USER@$CUSTCARE_SERVER:$CUSTCARE_HOME/$CUSTCARE_LOG.*... (2 Replies)
Hi,
I'm new to Linux. I would like to know how to scp a group of files. I have the below command, but it asks for remote password while sending each file. Is there a way to send all files (identified by - $ ls | grep '.*hrs0314a.*' | xargs -I {} grep -l '.*35663.*' {}) in one go?
$ ls |... (6 Replies)
Hi.
I'm trying to speed up an rsync command by running it in parallel. There's no real option for this other than if the files are in multiple directories (which they're not). And even then there's no way of knowing if rsync has succeeded as the process is running in the background .. and... (4 Replies)
hello,
i am trying to get a list of files to be scped from the remote server
by running the below in my local unix server ( note - there is a passwordless connectivity setup made between the local and remote server) and, we use KSH.
---
ssh $scp_host "find /a/b/c/*/ -iname "$remote_file"" >... (4 Replies)
I need to transfer multiple files using scp between two solaris machines. I could not use pattern since they match with other files in the same directory.
I tried the below command, it does not copy any files.
$ scp -p user@machine1:/home/fid1/staging/\{a.ksh,b.ksh,c.ksh,d.ksh\} .
But... (7 Replies)
I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code
TARFILE=${NAME}.tar
TARGZFILE=${NAME}.tar.gz
ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
I want to rename (move) multiple files on remote server. I tried the following command to move all TXT files from my_dir directory to /new_dir. But it does not work. Any help?
#!/bin/ksh
sftp -dev3 << ABC
cd my_dir
$(for i in TXT; do echo "ls *.$i" ; rename $x /new_dir/$x;... (1 Reply)
Discussion started by: Soham
1 Replies
LEARN ABOUT REDHAT
rexec
REXEC(1) General Commands Manual REXEC(1)NAME
rexec -- remote execution client for an exec server
SYNOPSIS
rexec [ -abcdhns -l username -p password ] host command
DESCRIPTION
Rexec calls the rexec(3) routine to act as a client for the remote host's rexecd(8) server.
It asks that ``command'' be run on the host computer, using username/password authentication. See rexec(3) and rexecd(8) for details of the
protocol.
OPTIONS
Rexec accepts several options, but only three are likely to be very useful:
-l username
Set the log-in name on the remote host to username.
-p password
Provide the password for the remote account. The command line argument will be blanked after being parsed, to prevent it from being
seen with ps(1). However, it is still not very secure to type the password on the command line. In particular, be sure that the
shell's history file is protected.
-n Explicitly prompt for name and password, even if provided in the environment, in the $HOME/.netrc file, or in the environmental
variables REXEC_USER and REXEC_PASS.
Other options that might be useful with non-standard remote exec daemons, or to debug connections:
-a Do not set up an auxiliary channel for standard error from command; the remote standard error and output are then both returned on
the local standard output. By default, rexec asks that a separate channel be set up for diagnostic output from the remote command.
-b Use signal handling as in BSD rsh(1). Only the signals SIGINT, SIGQUIT, and SIGTERM are echoed to the remote process. They do not
remain raised locally, so rexec waits for the remote command to shutdown its side of the socket. Also, CNTRL-Z will only suspend
execution locally--the remote command may continue to run.
-c Do not close remote standard input when local standard input closes. Normally the standard input to the remote command is closed
when the local standard input is closed.
-d Turn on debugging information. In particular the command sent to the remote host will be echoed.
-h Print a usage message.
-s Do not echo signals received by the rexec onto the remote process. Normally, signals which can be trapped are passed on to the
remote process; then, when you type CNTRL-C, the remote process terminates as well.
USERNAME AND PASSWORD Rexec(1) searches for the username and password in the following order:
1. If -n is given on the command line, the user will always be prompted for both, even if they are also given on the command line.
2. The command line will be parsed
3. If the environmental variables REXEC_USER or REXEC_PASS are defined, they will define the username or password.
4. The $HOME/.netrc file will be searched. See ftp(1) for a description of this file's format.
5. Finally, the user will be prompted if either the username or password remains undefined.
SECURITY
Users of this command should be aware that rexec(3) transmits their password to the remote host clear text, not encrypted. If the network
is not secure to the remote host, the password can be comprimised.
SIGNALS
Without the -b option, all signals which can be handled are echoed to the remote process. Afterwards, however, they remain raised in the
local process. Typically, this means that rexec(1) will exit after receiving a fatal signal, even if the remote process has arranged to
handle or ignore it.
Differing operating systems use differing signal numbers; for example AIX and SunOS use 18 for SIGTSTP (^Z), while Linux uses 20. There-
fore, it may have a different effect remotely than locally. In particular, typing CNTL-Z may not suspend the execution of the remote
process.
EXAMPLE
rexec othermachine cat ">remote_file; date" <local_file
will send local_file to the othermachine as remote_file.
BUGS
Please send bug reports, system incompatibilities, and job offers to the author.
SEE ALSO rexec(3), rexecd(8), rsh(1)AUTHOR
Michael Sadd
mas22@cornell.edu
http://www.tc.cornell.edu/~sadd/
Thanks to Orange Gopher (2/10/97) and Johannes Plass (plass@dipmza.physik.uni-mainz.de, Oct. 17 1996) for useful suggestions.
February 14, 1997 REXEC(1)