I am using root to backup and restore the files. But when I restored files, all the owner and group of files were changed to root and system. How can I restore the files and keep the original owner and group?
I assume you are putting them back in the same directories, with the same ownership and group as they had originally? or are you taking to another machine...?
if no mksysb just backup...
To restore a specific directory and the contents of that directory from a
file-system archive, enter:
restore -xvqf /dev/rmt0 /home/mike/tools
-------------------------
Assuming a mksysb tape...you have the -s4
restore -s4 -xqdvf /dev/rmt#.1 ./dir/filename (for one file)
OR
restore -s4 -xqdvf /dev/rmt#.1 ./dir (for all files in dir)
-x
Restores individually named files specified by the File parameter.
If the File parameter is not specified, all the archive members are
restored. If the File parameter is a directory and the archive is in
file-name format, only the directory is restored. If the File
parameter is a directory and the archive is in file-system format,
all the files contained in the directory are restored. The file names
specified by the File parameter must be the same as the names
shown by the restore -T command. Files are restored with the
same name they were archived with. If the file name was archived
using a relative path name (./filename), the file is restored relative
to the current directory. If the archive is in file-system format, files
are restored relative to the current directory.
The restore command automatically creates any needed
directories. When using this flag to restore file-system backups,
you are prompted to enter the beginning volume number.
-q
Specifies that the first volume is ready to use and that the restore
command should not prompt you to mount the volume
and hit Enter. If the archive spans multiple volumes, the
restore command prompts you for the subsequent volumes.
-d
Indicates that, if the File parameter is a directory, all files in that
directory should be restored. This flag can only be used when the
archive is in file-name format.
-v
Displays additional information when restoring. If the archive is in
file-name format and either the -x or -T flag is specified, the size
of the file as it exists on the archive is displayed in bytes.
Directory, block, or character device files are archived with a size
of 0. Symbolic links are listed with the size of the symbolic link.
Hard links are listed with the size of the file, which is how they are
archived. Once the archive is read, a total of these sizes is
displayed. If the archive is in file-system format
-f Device
Specifies the input device. To receive input from a named device,
specify the Device variable as a path name (such as
/dev/rmt0).
If you try to put it in a different directory or subdirectory which has different ownership
and/or permission that cannot be written to, you may run into problems..
The other thing that could cause problems with ownership and user is that user
does not exist on the system you are putting it on....i.e that id and group id do not
match the user from another machine...that could cause a change in ownership
and group..
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.