Linux Copy all the files including subdirectories from DVD / Floppy / CD / Other directory (recursive copy)

Posted on in Categories , , , , , last updated August 24, 2007

Q. How do I copy all the file including subdirectories from DVD disk mounted at /mnt/dvd to /home/tom at a shell prompt under CentOS Linux?

A. You need to use cp command to copy SOURCE to DESTINATION or multiple SOURCE(s) to a DIRECTORY. Gnu cp command has -a option which copy directories recursively while preserving the file attributes such as mode,ownership,timestamps and security contexts, if possible additional attributes such as links et all.

cp command syntax

Use the following syntax:
cp -a {/path/to/source} {/path/to/destination}

For example copy all files including subdirectories from /mnt/dvd/data to /home/tom/data, enter:
$ cp -a /mnt/dvd/data/* /home/tom/data
OR
$ cp -av /mnt/dvd/data/* /home/tom/data

Recursively copy entire directories

Many other command (including cp) support -r or -R option for copying file recursively. For example scp secure network copy command:
$ scp -r *.cpp remote_user@server.nixcraft.in:~
OR use cp command locally (instead of -a option):
$ cp -r *.cpp /path/to/dest

Howto install duplicity rpm under RedHat / CentOS / Fedora Core Linux

Posted on in Categories , , , last updated October 16, 2007

Q. I would like to use duplicity package to automatically encrypting and storing remote backups in a bandwidth efficient manner in our backup server. The server is already configured and I’d like to install the same under RedHat Enterprise Linux. How do I install duplicity w/o compiling from source code?

A. Duplicity is a piece of software which provides easy encrypted versioned remote backup of files requiring little of the remote server. It does this using GnuPG, tar, and rdiff. To transmit data it can use ssh/scp, local file access, rsync, ftp, and Amazon S3.

The best way to install it to use rpm files from DAG’s repo. For example RHEL 4 64 bit version can be installed using RPM command:
# wget http://dag.wieers.com/rpm/packages/duplicity/duplicity-0.4.2-1.el4.rf.x86_64.rpm
# rpm -ivh duplicity-0.4.2-1.el4.rf.x86_64.rpm

In order to use duplicity you need to create a GPG key:
# gpg --gen-key
Next run duplicity as follows to make backups:
# duplicity --encrypt-key="YOUR-KEY" /home scp://user@backup.server.com/directory
You can verify backups with –verify option:
# duplicity --encrypt-key="YOUR-KEY" --verify scp://user@backup.server.com/directory /home

Finally, if you need to restore file use command as follows:
# mkdir -p /disk3/resored.file
# duplicity --encrypt-key="YOUR-KEY" scp://user@backup.server.com/directory /disk3/resored.file

Read the man page of duplicity and gpg for more information and command options.

Linux or UNIX securely copy files across a network computer

Posted on in Categories , , , , , , , , , , last updated May 24, 2017

I know FTP is insecure, how do I securely copy files across a network computer? My network has Windows and Linux systems and how to copy files from one machine to another using ssh?
Continue reading “Linux or UNIX securely copy files across a network computer”