Retaining Directory Permissions While Using SCP

SCP is a secure file transfer protocol that is used in Linux. SCP is similar to FTP that it allows you to connect to a remote server and transmit your files via the connection. However there is one thing that SCP will allow you to do that FTP will not let you and that's the ability to retain the original directory permissions when in transport. This article will briefly explain how to do this.

  1. Log into your Linux server via SSH / Shell

  2. Locate the file or directory that you are waiting to transfer.

  3. Now you will connect to the remote server will you normally would using SCP, however now you will at a new attribure to the connection command. An example would be if you wanted to transfer a directory while keeping the permissions you would type the following;

  4. "scp -rp --preserve /your_directory_path root@remote_server:/directory"

  5. The addition of the "-p" attribute allows you to retain permissions while in transfer while the "-r" tells the system to recurisvely copy the entire contents of the directory.

  6. Using this command will allow you to transfer files quickly without the issue or worrying about reapplying permissions on the directories.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Installing htop

htop is an interactive process viewer for Linux, which is a powerful alternative to the...

Bind Multiple IP Addresses to a Single Network Interface Card (NIC)

This tutorial demonstrates how to bind multiple IP addresses to a single NICI'll be using LAN...

Clear Memory Cache on Linux Server

By default the Linux OS has a very efficient memory management process that should be freeing any...

Set the time on a Linux server

Log into the server via SSHAt the shell prompt run the following command:date MMDDHHmmYYYYFor...

Check your disk usage in Linux

A good way to check your disk usage for folders on your Linux server is via shell.Download...