DbAppWeb.com

Menu
  • Home
  • Linux
  • HP-UX
  • macOS
  • Windows
  • Web Servers
  • App Servers
  • Storage

Transfer file using scp: Permission denied

March 16, 2018 DbAppWeb Admin

Problem

I tried to copy a file from one Linux server dbappweb to another Linux server dbappweb1 but got the error ‘Permission denied’. I tried to copy the file using the SCP command over ssh.

[root@dbappweb public]# scp -p PKIServer.zip user1@dbappweb1:/home/user1/
user1@dbappweb1's password:
scp: /home/user1/PKIServer.zip: Permission denied

Reason

I got the “Permission denied’ error because that file was already at the destination location with read-only permission for the group and others. Due to the read-only permission files existing at the destination location not becoming replaced by the new file when I tried to copy the file through SCP.

[root@dbappweb1 user1]# ll PKIServer.zip
-rw-r--r-- 1 user1 user1 4855173 Feb 28 12:27 PKIServer.zip

Solution 1

  • First, delete the file existing at the destination location.
    [root@dbappweb1 user1]# rm PKIServer.zip
    rm: remove regular file `PKIServer.zip'? y
    [root@dbappweb1 user1]#
  • Now copy the file using scp command and it will be copied to the destination.
    [root@dbappweb public]# scp -p PKIServer.zip user1@dbappweb1:/home/user1/
    user1@dbappweb1's password:
    PKIServer.zip                                                                                   100% 4741KB   4.6MB/s   00:00
    [root@dbappweb public]#

Solution 2

  • Change the permission of the file from read-only to read-write for groups.
    [root@dbappweb1 user1]# chmod 664 PKIServer.zip
    [root@dbappweb1 user1]# ll PKIServer.zip
    -rw-rw-r-- 1 user1 user1 4855173 Feb 28 12:27 PKIServer.zip
    
  • Now copy the file using scp command and it will be copied to the destination.
    [root@dbappweb public]# scp -p PKIServer.zip user1@dbappweb1:/home/user1/
    user1@dbappweb1's password:
    PKIServer.zip                                                                                   100% 4741KB   4.6MB/s   00:00
    [root@dbappweb public]#

Note: In the above case both servers were RHEL 5.8.

Prev Article
Next Article
Tags:File System Linux SCP Sys Admin System Security

Leave a Reply Cancel Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Popular
  • Recent

Categories

  • Android (2)
  • Blogger (16)
  • Domain and Hosting (1)
  • Hardware Issues (7)
  • HP-UX (55)
  • HPE Data Protector (9)
  • IBM Lotus Notes (2)
  • IBM WebSphere Application Server (16)
  • Internet Tips & Tricks (15)
  • iOS (8)
  • JBoss/WildFly Application Server (2)
  • Linux (76)
  • macOS (15)
  • Microsoft Windows (31)
  • News and Updates (11)
  • Oracle Database (5)
  • SSL/TLS (1)
  • Storage Servers (23)
  • Tools/Softwares (1)
  • VMware ESXi (17)
  • Web Servers (14)
  • WordPress (5)

Archives

DbAppWeb.com

Solution of Database, Application and Web Server Problems

About DbAppWeb.com

One Stop Solution for Database Server, Application Server and Web Server Problems.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

DbAppWeb on Social Media

Copyright © 2025 DbAppWeb.com
Terms and Conditions   Theme by MyThemeShop.com