I have a folder which i want to create tgz file and compute its sha256:
The folder is converted to tgz using following command
"tar -c -C #{Shellwords.escape dir} #{Shellwords.escape basename} " \
"--owner=0 --group=0 --mtime='2000-01-01 00:00:00' | gzip -n > #{Shellwords.escape file}"
Now i ran the above process using 2 separate users and it gave me 2 files: 1 and 2
Both tgz files differ in sizes:
-rw-r--r--# 1 myuser \Domain Users 9024 Jul 31 14:28 1.tgz
-rw-r--r--# 1 myuser \Domain Users 9037 Jul 31 14:29 2.tgz
If i try to compute diff between files i dont see any diff.Diff was obtained using following command.
diff <(tar -tvf 1.tgz | sort) <(tar -tvf 2.tgz | sort)
If i compute sha256 using ruby of these 2 files , then it differs.
The question is : Why do i get difference in tgz files when running from different users.
the differences are in the headers, the header of each file in a tar contains the user and group id. see https://en.wikipedia.org/wiki/Tar_(computing)#Header .
Also modern tar adds additional data called Ustar to the header: https://en.wikipedia.org/wiki/Tar_(computing)#UStar_format
which contains also the owner username.
try:
diff <(gunzip -c 1.tgz | xxd) <(gunzip -c 1.tgz | xxd)
and you'll see the difference
While extracting a file using this command tar -zxf bluez-arm-package.tgz the owner(1000):group(pulse) of the files and directories is
changing as below example.
Example:
drwxrwxr-x 4 1000 pulse 1024 Jul 21 00:32 dbus-1
The actual should be:
drwxrwxr-x 4 root root 1024 Jul 21 00:32 dbus-1
There is an option for output stream in tar : --no-same-owner
So
tar xvf test_tar.tar --no-same-owner
will probably create files with user who launch this command as owner.
It's a little bit strange as this option (--no-same-owner) should be default for ordinary (non-superuser) users.
Does it work for you?
I am trying to view the content of a file ( in linux )that is inside a .war file without having to extract the war file. For example inside the war file i am trying to see the content of a file called aa.txt and which is under /path/here/ inside the war file.
jar has x option for that:
$ jar -help 2>&1 | grep extract
-x extract named (or all) files from archive
Let's try it:
$ jar tvf target/my.war | grep test-data
1811 Tue Jun 21 19:34:50 CEST 2016 WEB-INF/classes/test/spring/test-data.properties
$ jar xvf target/my.war WEB-INF/classes/test/spring/test-data.properties
inflated: WEB-INF/classes/test/spring/test-data.properties
$ ls -l WEB-INF/classes/test/spring/test-data.properties
-rw-rw-r--. 1 coder coder 1811 Jun 21 19:34 WEB-INF/classes/test/spring/test-data.properties
i create backup folder in ftp server , and send all my .tar.gz file into /backup folder
using (put file.tar.gz backup)
while i retrieve backup,, i get backup folder as backup files. ,, how to convert the file to folder ..
ftp server
ls
227 Entering Passive Mode (10,21,131,105,76,56)
150 Accepted data connection
drwxr-xr-x 6 100 ftpgroup 7 Oct 20 19:57 .
drwxr-xr-x 6 100 ftpgroup 7 Oct 20 19:57 ..
-r-------- 1 100 ftpgroup 84 Oct 21 11:15 .banner
drwxrwxrwx 3 100 ftpgroup 4 Oct 20 18:28 backup
drwxrwxrwx 2 100 ftpgroup 3 Oct 20 19:45 dailybackup
drwxrwxr-x 2 100 ftpgroup 3 Oct 20 19:57 hi5songs
drwxrwxr-x 2 100 ftpgroup 3 Oct 20 19:49 whole
226-Options: -a -l
226 7 matches total
i tried :
ftp> mget backup``
mget .? y
227 Entering Passive Mode (10,21,131,105,62,8)
550 I can only retrieve regular files
mget ..? y
Warning: embedded .. in .. (changing to !!)
227 Entering Passive Mode (10,21,131,105,46,39)
550 Can't open !!: No such file or directory
mget backup? y
227 Entering Passive Mode (10,21,131,105,72,24)
550 I can only retrieve regular files
mget cpanelbackup? y
227 Entering Passive Mode (10,21,131,105,73,69)
550 Can't open cpanelbackup: No such file or directory
while
i use (get backup home)
it successfully retrieve but as files shown below
server:
'root#azar [/home]# ls
./ backup.2* .cpan/ dailybackup hi5songs.4 oldeserver
../ backup.3* cPanelInstall/ hi5songs/ hi5songs.5 oldserver/
0_README_BEFORE_DELETING_VIRTFS backup.4* .cpanm/ hi5songs.1 home quota.user
backup/ backup.5* .cpcpan/ hi5songs.2 latest virtfs/
backup.1* .banner cpeasyapache/ hi5songs.3 lost+found/ whole'
i got that backup with green color executable file like backup.1* ( note: i cant open those file and extract those files) what to do
how to get my .tar.gz file back
please guide me,,
advance thanks,,
Updated Answer
If you want to get all files from /some/place on your server, to /home/here on your local machine, you would either do this:
cd /home/here # change directory before starting FTP
ftp server ... # connect
cd /some/place # go to desired folder on server
bi # ensure no funny business with line-endings
mget * # get all files
or you can change directory locally, within FTP like this:
ftp server ... # connect
cd /some/place # go to desired folder on server
lcd /home/here # LOCALLY change directory to where you want the files to 'land'
bi # ensure no funny business
mget * # get all files
Original Answer
I cannot understand your question at all, but you are doing some things wrong.
You cannot use GET or MGET to get a folder (directory) like you are trying to do with mget backup. You can only GET a file. Now your file may be a tar-file with more than one file in it, but it is still a file.
If you are getting tar-files and binary files, you should use BINARY mode to ensure line-end characters that may occur in binary files are not translated between Windows and Unix line-endings. So, as a matter of course, you should issue BI command before you get files.
If you have several files in your backup directory, you should probably do cd backup then bi
then mget *
Earlier, I tried to put the file on the host kml. My question here Not showing the path in KML. Now I created new file kmz on the recommendations of Google. File here: http://tourist-sweden.se/transport/map/sthlm/t-11-1.kmz . Calling map: http://tourist-sweden.se/transport/map/sthlm/t-11-bana.html
Now maps show only the path but do not show of my icons. What a mistake again in my maps? Are there any robust and simple alternative to kml?
Your KMZ file is not correct. If you zip up the t-11 directory, it works:
It currently looks like this:
[lross#JJ kmz]$ unzip -l t-11-1.kmz
Archive: t-11-1.kmz
Length Date Time Name
-------- ---- ---- ----
0 07-07-13 12:06 t-11/
3655 07-07-13 12:43 t-11/t-11-bana.kml
0 07-07-13 12:08 t-11/files/
1039 07-04-13 21:21 t-11/files/subway-blue.png
If you create it from the t-11 directory so it looks like this, it works:
[lross#JJ t-11]$ unzip -l t-11-1a.kmz
Archive: t-11-1a.kmz
Length Date Time Name
-------- ---- ---- ----
0 07-07-13 12:08 files/
3655 07-07-13 12:43 t-11-bana.kml
1039 07-04-13 21:21 files/subway-blue.png
http://www.geocodezip.com/v3_GoogleEx_layer-kml_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/kmz/t-11-1a.kmz