#1  
Old 12th August 2009, 20:22
ramesh_rncbe ramesh_rncbe is offline
Junior Member
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to Automate SCP...

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...
Reply With Quote
Sponsored Links
  #2  
Old 12th August 2009, 22:05
id10t id10t is offline
Senior Member
 
Join Date: Nov 2008
Posts: 242
Thanks: 2
Thanked 22 Times in 22 Posts
Default

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
Reply With Quote
  #3  
Old 13th August 2009, 13:04
ramesh_rncbe ramesh_rncbe is offline
Junior Member
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

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...
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate user signup. Tommahawk Tips/Tricks/Mods 179 26th June 2010 03:47
Automate account creation from website? keyvan General 1 14th May 2009 19:21
Allow SCP but not SSH (How?) Mosquito Server Operation 1 25th October 2008 12:00
scp with password knowram Technical 2 5th March 2007 19:40
ssh chroot works, but no scp for chroot users zokahn HOWTO-Related Questions 5 30th January 2006 10:33


All times are GMT +2. The time now is 13:46.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.