I am trying to move files from local server to remote unix server... for that I am using SCP to achieve this.... I have written script to achieve this but with password prompt.... Login username on remote is tester1... After login i will do sudo to login as the application user... thru sudo command... Eg : Sudo /usr/local/bin/mcfs mcfs -> Application user.... After doing scp..if i try ll command... it shows the UID as tester1... but we need it as mcfs application user.. so that developers can access the file without any problem... Above task is achieved by using shell script but only as tester1 not with sudo user... Any help would be really apprecaited...
You need to scp the files as the MFC user scp somefile mfcuser@remotebox:/path/to/copy/file/to You could also set it up wtih passwordless SSH keys to automate copying so you don't have to enter a pw
Thanks for your reply... please look at the script and help me on this.... #!/bin/sh INI_FILE=/home/pvcs/Ram/path.ini # INI_FILE is the input file that's where we have the host , Remote host and # source and destination directories mentioned. if [ -f ${INI_FILE} ] then #Run the INI_FILE echo "Running INI FILE" . ${INI_FILE} echo "${INI_FILE}" echo "${HOST}" echo "${D_HOST}" else echo " \n Environment file <PATH.INI> not present. Please check. \n" exit 1 fi perm() { cd ${SRC_DIR} chmod -R 775 * } perm; File_Transfer() { cd ${SRC_DIR} cat /home/pvcs/Ram/scp1.sh | ssh ${USER}@${D_HOST} # scp1.sh is sudo user file.. where the below mentioned command will # be executed.... #sudo /usr/local/sbin/mcds } File_Transfer; File_SCP() { # sudo /usr/sbin/sudo/mcds scp -p ${SRC_DIR}/*.sh ${USER1}@${D_HOST}:${DES_DIR} } File_SCP; Can you help me how to add the mfc user in this scripts... i am new to scripting... Any help would be really helpful...