Q. Iâ€™m using CentOS Linux. Iâ€™m getting an error – Cannot Preserve Ownership, when I try to copy files from Linux ext3 to FAT32 or files moved to an NFS NAS server mount point. How do I fix this error and copy / move files?
A. Generally you use command like cp or my to copy file. While copying a file these command try to copy file attributes such as ACL information or group access information etc. FAT32 and NFS mount mount cannot support all sort of attributes and these commands cannot differentiate between a filesystem that doesn’t support ACL and Linux file system permission.
All your files will be copied or moved without ACL and permissions. You can ignore this error and files should be copied / moved successfully. Sysadmin because even developers need heroes!!!
Q. FTP is insecure, how do I securely copy files across a network computer? My network has Windows and Linux systems.
A. You need to use Openssh client and server technology to copy between two more network computers. You can also find free ssh client tools. scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh.
Copy from Linux to Linux/UNIX system
Copy file called data.txt to ras.nixcraft.in Linux system (vivek is username):
$ scp data.txt firstname.lastname@example.org:/home/vivek
Copy more than two files:
$ scp data.txt pic.jpg email@example.com:/home/vivek
Copy /data directory and all files inside /data i.e. recursively copy entire directories:
$ scp -r /data firstname.lastname@example.org:/home/vivek
Copy from Windows to Linux/UNIX system
You can download any one of the following free Windows SCP client
Just install above client and follow on screen instructions.
Q. Can you explain how do I use cpio under Linux / UNIX?
A. GNU cpio is a tool for creating and extracting archives, or copying files from one place to another. It handles a number of cpio formats as well as reading and writing tar files. cpio command works just like tar, only better.
As I said earlier, cpio works like tar but it can read input from the “find” command. This is nifty feature. For example you can find out all *.c files and backup with cpio command.
# find / -name "*.c" | cpio -o --format=tar > c-file.backup.tarYou can also specify file name using -F option:
# find / -iname "*.pl" | cpio -o -H tar > perl-files.tar
# find / -iname "*.pl" | cpio -o -H tar -F perl-files.tarWhere,
- -o: Create archive
- -F: Archive filename to use instead of standard input or output. To use a tape drive on another machine as the archive.
- -H format: Specify file format to use.
- -i: Restore archive
You can extract archive with the following command:
# cpio -i -F perl-files.tarYou can list file inside archive i.e. list contents of the cpio file with following command:
# cpio -it -F perl-files.tarYou can write archive of /home to tape (drive /dev/nst0), type the following command:
# find /home | cpio -o -H tar -F /dev/nst0Restore backup using following command:
# cpio -i -F /dev/nst0Backup /home dir, to remote system tape drive:
# find /home | cpio -o -H tar -F email@example.com:/dev/nst0 --rsh-command=/usr/bin/ssh