troubles with images download via ftp

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
Morgenstern
Posts: 19
Joined: Mon 10. Oct 2005, 19:30

troubles with images download via ftp

Post by Morgenstern »

I want to download some pictures for example 20as302as0311091091.jpg on my computer by ftp.

But I don't have the rights to download it and i'm not able to change CHMOD to 777.

1. Is this because of phpwcms?

2. If yes, how can I download this pictures even though?
Pappnase

Post by Pappnase »

hello

if you don't have the permission to download your images from your filestorage dir. i would contact your host.
twaso
Posts: 15
Joined: Thu 12. Jan 2006, 17:20
Contact:

Post by twaso »

This is a common problem. See also:

http://www.phpwcms.de/forum/viewtopic.php?t=9768
Pappnase

Post by Pappnase »

hello

but from where came this problem? could it be that is an missconfiguration of webspaces!!?
twaso
Posts: 15
Joined: Thu 12. Jan 2006, 17:20
Contact:

Post by twaso »

Files uploaded via php should get permissions 644. Many providers are setting these permissions to 600 and are not going to change this policy for security reasons. They say it is not a problem for most of their customers, so why should it be a problem for the users of phpwcms.

I think we should do something about it. Changing hosting is not a solution, because the new hosting provider could adopt this permissions strategy at any point in the furture.
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

think that if a Provider has these Settings, hi also don't allow to modify the Permissions by php-command chmod(); ?!
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
twaso
Posts: 15
Joined: Thu 12. Jan 2006, 17:20
Contact:

Post by twaso »

I am sure 50% of all phpwcms users do have this problem and dont even know about it. This is because everything seems OK until you try to make a backup of your site. (Try to download your filestorage via ftp)

Backing up your whole site via ftp is very important, since the backup of your provider is only for the case that his machines die. It is useless if you get hacked or you mess something up yourself. In these cases the backup of your provider will also contain all the messed up files and you have lost everything.
twaso
Posts: 15
Joined: Thu 12. Jan 2006, 17:20
Contact:

Post by twaso »

Hi Horst,

To modify the Permissions by php-command chmod() is exactly the solution my provider suggests. Unfortunately I dont know enough about php programming to do these modifications to the code myself and check if he is right.

Thomas
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

goto include/inc_tmpl/files.private.upload.tmpl.php search this (Line~97)

Code: Select all

} else {
				$oldumask = umask(0);
				if(@mkdir($useruploadpath, 0777)) {;
					if(!@move_uploaded_file($_FILES["file"]["tmp_name"], $usernewfile)) {
						$file_error["upload"] = $BL['be_fprivup_err3'].' (2)';
					}
				} else {
					$file_error["upload"] = $BL['be_fprivup_err4'];
				}
				
				umask($oldumask);
			}
after this add
so that it look like

Code: Select all

chmod($usernewfile, 0777);

Code: Select all

} else {
				$oldumask = umask(0);
				if(@mkdir($useruploadpath, 0777)) {;
					if(!@move_uploaded_file($_FILES["file"]["tmp_name"], $usernewfile)) {
						$file_error["upload"] = $BL['be_fprivup_err3'].' (2)';
					}
				} else {
					$file_error["upload"] = $BL['be_fprivup_err4'];
				}
				
				umask($oldumask);
			}
			chmod($usernewfile, 0777);
			
			if(!isset($file_error["upload"])) {..........
			
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
twaso
Posts: 15
Joined: Thu 12. Jan 2006, 17:20
Contact:

Post by twaso »

Hi Horst!

Vielen Dank, ich werde das gleich probieren,

Thomas
twaso
Posts: 15
Joined: Thu 12. Jan 2006, 17:20
Contact:

Post by twaso »

Hi Horst!

Problem solved. Funktioniert bestens! Habe chmod (0666) verwendet.

Code: Select all

chmod($usernewfile, 0666);
nochmals Danke! Vielleicht könnte man das in die offizielle Version integrieren.

lg.

Thomas
Peekay
Posts: 286
Joined: Sun 25. Jul 2004, 23:24
Location: UK

Post by Peekay »

To backup your existing files via FTP you will need to change the ownership of the files that have 'nobody' or 'apache' as user and group. To do that yourself you will need a shell access account with your host that allows you to log in as 'root'.

Assuming you can do that, login and change directory to your main web root, e.g.

Code: Select all

# cd /var/www/httpdocs
Next, use the LS command with the -l switch (that's a lower-case 'L') to get a directory listing.

Code: Select all

# ls -l 
This will reveal your username and group next to the files you 'own', e.g:

index.php -rw-r--r-- me mygroup

You then need to use the CHOWN command to change ownership of the files in 'phpwcms_filestorage' to your user and group.

Code: Select all

# chown -R me.mygroup phpwcms_filestorage
The -R switch recursively changes the owner of all the files in the folder, plus any sub-folders. Run the LS command again afterwards to check that ownership has changed.

You should now be able to change permissions and download via your FTP application.

I assume the above hack is now a permanent feature of PHPWCMS :?:
Keppn
Posts: 80
Joined: Wed 14. Jul 2004, 18:16

Re: troubles with images download via ftp

Post by Keppn »

Hello all!

The new version 1.3.5 seems to re-establish this problem: Newly uploaded files through
the filemanager only have permission CHMOD 600, so that thumbnails or resized versions
are not shown in the browser.

In the file "include/inc_tmpl/files.private.upload.tmpl.php", at the point Pico pointed out,
there is already a new line to be found:

Code: Select all

if(file_exists($usernewfile)) {
				chmod($usernewfile, 0666);
			}
But it doesn't seem to work. My provider is unwilling to change the standard-chmod
of the server to anything else than CHMOD600. He was helpful though in putting in
some "echos" in this file, and reported that the CHMOD-line above does not get
parsed... has anyone else experienced the same? Is this a bug? Should I contact OG?

It would be great if someone could help me with this issue, I don't know what to do now... :[


------------------------------


Hallo zusammen,

mit der phpwcms-Version 1.3.5 habe ich leider auch wieder das ursprüngliche Problem:
Wegen mangelnder Rechte der hochgeladenen Dateien (CHMOD 600) werden keine
Thumbnails generiert.

An der von Pico beschrieben Stelle in der Datei include/inc_tmpl/files.private.upload.tmpl.php
findet sich in der Version 1.3.5 auch schon die Zeile

Code: Select all

if(file_exists($usernewfile)) {
				chmod($usernewfile, 0666);
			}
Dennoch haben hochgeladene nur CHMOD 600. Der Provider ist leider ist leider nicht dazu
zu bewegen, diese Standardeinstellung zu ändern. Er hat jedoch probehalber "echos" in die
include/inc_tmpl/files.private.upload.tmpl.php eingebaut, und nach seiner Aussage wird
die obige Codezeile mit dem CHMOD 0666 gar nicht verarbeitet... was also nun?

Wäre toll, wenn mir jemand hier weiterhelfen könnte, da sitze ich wirklich etwas in der Patsche... :[
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: troubles with images download via ftp

Post by Jensensen »

For me all files which are written to this directory by phpwcms are CHMOD 0666.
But unlike the original files I once uploaded to the server
USER and OWNER now are --> 'nobody'

When you log in to your server using FTP with your --> USERNAME 'ftp123abcXYZ' you'll need at least '0604' for the files to be able to download (as you are not 'nobody' or within its group).

If you can't manage CHMOD / are not allowed to manage YOUR files by the web provider, I would terminate/cancel the agreement asap and use another one for hosting my sites.
The problem you have isn't phpwcms related but you will have the samewith ANY other web app on this server as well.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
Post Reply