1834112 Members
2443 Online
110063 Solutions
New Discussion

Re: SCP

 
S.Arunkumar
Trusted Contributor

SCP

Hi all

I need to do SCP from my host to other host in client side.I dont wat to type my password physically everytime when I do scp.Instead is there anyway to do it.

Basically i would like to the copy session as a script.

Thanks
Arunkumar
5 REPLIES 5
Arunvijai_4
Honored Contributor

Re: SCP

Hi Arun,

Take a look at this link, It should help.

http://www.mail-archive.com/ssh@clinet.fi/msg04511.html

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
VEL_1
Valued Contributor

Re: SCP


For connection scp from a local machine to a remote machine without always typing a password, on the remote machine, create the file ".shosts" in your home that contains the name of the local machine. Permission should be 600. SCP will use the ssh_know_hosts file. If the local machine is correctly entered in the user's .ssh/known_hosts file, then the connection will be permitted with out a password.


Eg:

From local machine as whatever USER u want without password,

1. ssh -X

Using the above command, u can add the host in known host file.

2. ssh -X

After the successful connection, exit from the local machine.









Rajeev  Shukla
Honored Contributor

Re: SCP

Here is what you need to do.
1. Generate the public and private key on the client machine using ssh-keygen -t dsa command
2. It will generate id_dsa and id_dsa.pub file in $HOME/.ssh directory which are your private and public key
3. copy the public key (id_dsa.pub) file to your target server
4. either copy this file on target host as $HOME/.ssh/authorized_keys or is the file exists then copy the content of public key in this file.

Now your scp will work without prompting for password using the public and private key.
Mel Burslan
Honored Contributor

Re: SCP

create a public, and private keypair using

/opt/ssh/bin/ssh-keygen -t dsa

when asked for a passphrase, hit enter without typing anything, and confirm it one more time when asked the second time.

and save this key pair in the default location, which should be:

$HOME/.ssh/id_dsa

then take the id_dsa.pub and copy it to the remote host using rcp, ftp, scp or any other tool of your choice. You still need to enter your password this time as well, if you are using scp.

make sure the public key file has only one line in it, i.e.,

wc -l /tmp/id_dsa #assumed you copied it to /tmp

shows 1 line as a result on the remote node.

goto the home directory of the user name on the remote node. If exists a directory called .ssh (most likely it will exist)

cd .ssh

otherwise create the directory and go in it.

once in .ssh directory, run command

cat /tmp/id_dsa.pub >> authorized keys

then go back to the local node and issue command,

ssh remote_node

it will ask you if you want to permanently store the key from this host with a yes/no answer. Answer "yes" to this question not "Y" or "y", type the full word yes.

At this point you should be good to go. you can ssh or scp from this host to the remote host, seamlessly, without typing a password.

hope this helps.
________________________________
UNIX because I majored in cryptology...
Steven E. Protter
Exalted Contributor

Re: SCP

see doc attached

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com