Welcome Guest, Not a member yet? Register   Sign In
Packing files via SSH, how to?
#1

[eluser]Référencement Google[/eluser]
Hi,

Not CI related, but Linux server related, sorry to post my question on my favorite forum ;-)

I need via SSH to make a pack of files (.tar.gz or zip ?) that will keep the CHMOD information, so when I unpack to another server I keep the same rights on folder and files. Is there a way to do that?
#2

[eluser]Yash[/eluser]
if you will execute the file on another server you required different permission compare to your original file permissions.

so I guess you have to read permission store it and later save it.You can done all this with php.
#3

[eluser]Référencement Google[/eluser]
That would be a pain doing this with PHP only for a 1 time use (because in fact, I need to export a website on another server, the problem is that there is a lot of files and I don't know where and how are all the permissions) Are you sure there isn't a way to do this by SSH ?
#4

[eluser]johnwbaxter[/eluser]
Yeah sock puppet is spot on.

Also, this sort of question should go in the lounge really i reckon.
#5

[eluser]Référencement Google[/eluser]
Quote:Also, this sort of question should go in the lounge really i reckon.

You are right, also I wasn't sure were to post it, I am sure nobody won't have a big pain about my post Tongue

Quote:You are doing this via the command line, and not PHP, right? In this case: man tar.


Yes I am under command line... One question about the .tar format, will it keep the CHMOD permissions? (That was the most important for me)
#6

[eluser]johnwbaxter[/eluser]
http://unixhelp.ed.ac.uk/CGI/man-cgi?tar should give you some info, i think using -p should preserve the permissions.
#7

[eluser]Eric Cope[/eluser]
man page for tar

tar -czf archive_file_name.tgz directory_or_file_to_archive
-c = create a new file
-z = compress using gzip, bzip2 is probably available too
-f = lists all files in your tar verbosely (I forget what that means to the end user, but I use it all the time to tar up files.

to untar it:
tar -xzfp archive_file_name.tgz
-x = extract (opposite of create)
-z = uncompress
-f = see above
-p = preserve permissions
#8

[eluser]Référencement Google[/eluser]
Great!
Many thanks for the help all of you, I will try that tonight.




Theme © iAndrew 2016 - Forum software by © MyBB