Sponsored Content
Top Forums Shell Programming and Scripting Tar change ownership after untar Post 303045793 by sdosanjh on Monday 13th of April 2020 03:14:52 PM
Old 04-13-2020
Tar change ownership after untar

Hi All,
How can i change the file permissions after untarring the file

Code:
 tar -Pcvf - $filename |ssh -p222 username@<Some JUMPBOX> "ssh user@<xyz machine> 'tar -Pxvf -'"

Shall i give as

Code:
 tar -Pcvf - $filename |ssh -p222 username@<Some JUMPBOX> "ssh user@<xyz machine> 'tar -Pxvf - chmod 666 -\'"

But this does not send the file to destination. Pls help

Last edited by sdosanjh; 04-13-2020 at 04:31 PM..
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Preserving Ownership w/tar

I'm trying to make a backup of a directory tree on Solaris 8. I'm doing this with my own ID, not root. The problem I am running into is when I extract the archive, all files are owned by me and the group is my default group. The man page lists this as the default behavior when executed by a... (1 Reply)
Discussion started by: bergerj3
1 Replies

2. UNIX for Dummies Questions & Answers

Untar a TAR file at different location

Hi, I want to UNTAR a TAR file at different location. Is it possible? My TAR file contains the files with absolute path. Malay (5 Replies)
Discussion started by: malaymaru
5 Replies

3. UNIX for Advanced & Expert Users

Tar utility (untar a .tar file) on VxWorks

Hi All Can someone pls guide me if there any utility to compress file on windows & uncompress on vxworks I tried as - - compressed some folders on windows ... i created .tar ( to maintain directory structure ) and compressed to .gz format. - on VxWorks i have uncompressed it to .tar... (1 Reply)
Discussion started by: uday_01
1 Replies

4. Shell Programming and Scripting

Script to untar latest tar file

I am trying to put together a script that will check for the latest file in a directory then extract it. The extraction and the scheduling I can do, but am not sure how to get it to check for the latest file. These files are uploaded every evening by an external party and the previous days files... (3 Replies)
Discussion started by: stheologo
3 Replies

5. UNIX for Dummies Questions & Answers

tar and untar commands

I have a script to ftp, archive and delete files. I used tar command to archive files from a list and then all files were removed from name1/name2/name2/. find /name1/name2/name2/ -name "*.txt" -print > filelist.log while read line do if ; then tar cvf $tarfile $line else ... (3 Replies)
Discussion started by: Lenora2009
3 Replies

6. UNIX for Dummies Questions & Answers

untar a tar file

how can I untar a file without extracting it? sample: file.tar to file thanks, lara (1 Reply)
Discussion started by: lhareigh890
1 Replies

7. UNIX for Advanced & Expert Users

tar and untar the files using single line

Hi, i want tar the files from one location and untar it to other location using single line. Can any one help me zip and unzip using single line command. (2 Replies)
Discussion started by: venikathir
2 Replies

8. Red Hat

tar/untar over ssh

I use red hat linux. I have two linux server . I want to use tar over ssh to tar and untar the file. The server A , have IP 10.1.1.a ,there is dir a and contain files. The server B have IP 10.1.1.b , there is dir b and contain file . So, in above case ,how can I tar over ssh sunc that the file... (0 Replies)
Discussion started by: chuikingman
0 Replies

9. UNIX for Dummies Questions & Answers

How to Untar tar.gz to particular directory

Hi Guys, I am able to untar a tar.gz file. But it is again extracting the tar file to further child directory. I even tried the below command to untar it to particular directory. tar -zxvf gme_dly_sls_20120515035335.txt.tar.gz -C /sites/VSTAR/site/live/ftp/GMEUROPE I am getting the below... (4 Replies)
Discussion started by: mac4rfree
4 Replies

10. Shell Programming and Scripting

Untar only folder structure from a tar ball

I have a tar file hello.tar which is 95 GB. hello.tar has many files and folders including some tar files as well. I wish to create a new tar ball which should maintain only the folder structure of hello.tar and the tar ball within the hello.tar So basically the idea is to untar... (2 Replies)
Discussion started by: mohtashims
2 Replies
ln(1)							      General Commands Manual							     ln(1)

NAME
ln - link files and directories SYNOPSIS
file1 new_file file1 [file2]... dest_directory directory1 [directory2]... dest_directory DESCRIPTION
The command links: o file1 to a new or existing new_file, o file1 to a new or existing file named file1 in existing dest_directory, o file1, file2, ... to new or existing files of the same name in existing dest_directory, o directory1, directory2, ... to new directories of the same name in existing dest_directory, o or it creates symbolic links between files or between directories. If links are to dest_directory, corresponding file or directory names in that directory are linked to file1, file2, ..., or directory1, directory2, ..., etc., as appropriate. If two or more existing files or directories (excluding destination file name new_file) are speci- fied, the destination must be a directory. If new_file already exists as a regular file (or link to another file), its contents (or the existing link) and its ACL are destroyed only if the option is specified. The ACL on the new_file after the link is the same as that of the source_file file. If the and options are specified and the link being created is the name of an existing link or ordinary file and the access permissions of the file forbid writing, asks permission to overwrite the file. If the access permissions of the directory forbid writing, aborts and returns with the error message: (even if the file is an ordinary file and not a link to another file). When asking for permission to overwrite an existing file or link, prints the mode (see chmod(2) and below), followed by the first letters of the words and in the current native language, prompting for a response, and reading one line from the standard input. If the response is affirmative and is permissible, the operation occurs; if not, the command proceeds to the next source file, if any. Hard links are created with the same ownerships and permissions as the file or directory to which they are linked. If ownership or permis- sions are changed on a link or file, the same changes appear on corresponding hard links. The command does not permit hard links to a directory. Symbolic links are created with the ownership of the creator and the permissions are of the creator's current umask. Once created, the symbolic link ownership and permissions will not change, since the mode and ownership of the symbolic link is ignored by the system. If file1 is a file and new_file is a link to an existing file or an existing file with other links, new_file is disassociated from the existing file and links and linked to file1. When creates a link to a new or existing file name, ownerships and permissions are always identical to those for the file to which it is linked. If or is used to change ownership or permissions of a file or link, the change applies to the file and all associated links. The last modification time and last access time of the file and all associated links are identical (see chown(1) and chmod(1)). For a discussion of symbolic links, see symlink(4). Options The command recognizes the following options: Force existing destination path names to be removed to allow the link. Write a prompt to the standard error output requesting confirmation for each link that would overwrite an existing file. This option takes effect only if used in con- junction with the option. Cause to create symbolic links instead of the usual hard links. A symbolic link contains the name of the file to which it is linked. The referenced file is used when an operation is performed on the link (see open(2)). A on a symbolic link returns the linked-to file; an must be performed to obtain information about the link (see stat(2)). A call can be used to read the contents of the symbolic link (see readlink(2)). Symbolic links may span file systems and refer to directories. Access Control Lists (ACLs) If optional ACL entries are associated with new_file, displays a plus sign after the access mode when asking permission to overwrite the file. If new_file is a new file, it inherits the access control list of file1, altered to reflect any difference in ownership between the two files (see acl(5) and aclv(5)). In JFS file systems, new files created by do not inherit their parent directory's default ACL entries (if any), but instead retain their original ACLs. EXTERNAL INFLUENCES
Environment Variables determines the interpretation of text as single byte and/or multibyte characters. and determine the local language equivalent of (for yes/no queries). determines the language in which messages are displayed. If is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty vari- able. If is not specified or is set to the empty string, a default of (see lang(5)) is used instead of If any internationalization vari- able contains an invalid setting, behaves as if all internationalization variables are set to See environ(5). International Code Set Support Single byte and multibyte character code sets are supported. EXAMPLES
The following command creates and in which are linked back to the original files and If and/or exists in the destination directory, it is removed and replaced by a link to or respectively. If existing file or is a link to another file or a file with links, the existing file remains. Only the link is broken and replaced by a new link to or WARNINGS
does not create hard links across file systems. DEPENDENCIES
NFS Access control lists of networked files are summarized (as returned in by but not copied to the new file. When using on such files, a is not printed after the mode value when asking for permission to overwrite a file. AUTHOR
was developed by AT&T, the University of California, Berkeley and HP. SEE ALSO
cp(1), cpio(1), mv(1), rm(1), link(1M), readlink(2), stat(2), symlink(2), symlink(4), acl(5), aclv(5). STANDARDS CONFORMANCE
ln(1)
All times are GMT -4. The time now is 03:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy