Home » RDBMS Server » Server Administration » scp
scp [message #61685] Mon, 17 May 2004 22:59 Go to next message
Venkat
Messages: 110
Registered: February 2001
Senior Member
Hi when i am trying to copy a directory using the SCP , after giving the password it says that permission denied. is this due to the permission problem on unix box.

Command : scp -r <dir>   <username>@<server>:<dir>

after giving the password it says that

 

./<dir> :permission denied

Thanks ,

Venkat.

 
Re: scp [message #61699 is a reply to message #61685] Tue, 18 May 2004 17:04 Go to previous messageGo to next message
Trifon Anguelov
Messages: 514
Registered: June 2002
Senior Member
The right syntax is:

$ scp -r dirname username@remotehost:/remote-dir

HTH,

clio_usa - OCP 8/8i/9i

DBAclick.com
Re: scp [message #167838 is a reply to message #61699] Mon, 17 April 2006 07:57 Go to previous messageGo to next message
rajus19
Messages: 18
Registered: September 2005
Junior Member
Hi, this is the doc to enable scp.

These are the basic steps to setup Secure FTP
between two machines. If this is done, scp and sftp commands will work fine without prompting for password, and hence we can avoid
hardcoding any password in the script.
For enabling scp or sftp from user1 in server1 to any directory owned by user2 in server2, these are the steps.
-----------------------------------------------------------------
1. Login to server1 as user1.
2. Run the command /opt/openssh2/bin/ssh-keygen –t dsa
Default file to store the key will be shown as <HOME_USER1>/.ssh/id_dsa (where <HOME_USER1> is the home directory of user1, select this default location)
When prompted for passphrase, type ‘Enter’
3. cd to <HOME_USER1>/.ssh
4. There should be two files present, id_dsa and id_dsa.pub
5. id_dsa is the private key, and it should be left there itself.
6. id_dsa.pub is the public key, it should be distributed to any system to which we want to do secure ftp. (See from step 7 on what to do in the second system)
7. On server2, login as user2, go to <HOME_USER2>/.ssh
8. Get the id_dsa.pub from server1. This should be added to the file <HOME_USER2>/.ssh/authorized_keys by either of the below steps:
If the <HOME_USER2>/.ssh/authorized_keys file does not exist, do ‘mv id_dsa.pub <HOME_USER2>/.ssh/authorized_keys’
If the <HOME_USER2>/.ssh/authorized_keys file already exists, do ‘cat id_dsa.pub >> <HOME_USER2>/.ssh/authorized_keys’
9. In server1, <HOME_USER1>/.ssh/known_hosts should contain an entry for server2 for secure ftp to work. The easy way to do it, is to
try to do scp or sftp from server1 to server2 manually once, when you will get a message similar to below.
The authenticity of host 'asdf5245(161.65.25.35)' can't be established.
DSA key fingerprint is 7b:a9::26:a3:c8:b9:49:42:32:f5.
Are you sure you want to continue connecting (yes/no)?
Type ‘yes’ here. This will add the server2 entries in the known_hosts file. From the next time, this prompt will not come, and so it will work from a script
without any prompting.
--------------------------------------------------------------------
Please note: The above steps will enable us to do scp or sftp from user1@server1 to user2@server2. It doesn’t work for any other user, or from the same
user on another server. Even the opposite won’t work, ie scp or sftp from user2@server2 to user1@server1 will not work. For that, you need to do the above steps
again, ie, generate the key in server2 and add it to the authorized_keys in server1.
Please contact me in case of any questions.
Re: scp [message #167891 is a reply to message #167838] Mon, 17 April 2006 14:33 Go to previous message
madhusunkara
Messages: 59
Registered: March 2006
Location: hyderabad,india
Member
>> ./<dir> :permission denied

could be permission problem with the target directory , try copying a test file into /tmp on target server

HTH
Madhu
Previous Topic: take backup
Next Topic: how to convert non unicode to unicode (through application)?
Goto Forum:
  


Current Time: Fri Sep 20 13:37:57 CDT 2024