New in CWP Edge / LTSFree with every CWPpro licenceWebsites up to 300x faster

CWP now includes LSPHP, LSAPI-Cache and CWP Cage at no extra cost with all CWPpro licences. The LSAPI-Cache plugin is integrated into our WordPress and other script installers. Available now in the Edge-Latest and LTS-Stable versions. Discuss in the forum

LSPHP / Cache ›
CWP Secure KernelKernel-level protectionEvery site in its own sandbox

Every PHP site, cron job and SSH session runs in its own profile that the kernel enforces. A hacked WordPress cannot read other accounts’ files, and crypto miners and unexpected processes are stopped. Discuss in the forum

Secure Kernel ›
CWP DataCenter PanelFree for CWPpro serversAll your servers on one screen

Manage all your CWP servers from one panel: live health, every hosting account, CWP and OS updates on many servers at once, backups, SSL, firewall and Telegram alerts. Discuss in the forum

DataCenter Panel ›
CWP Backup ServerFree for CWPpro serversBackups that ransomware cannot reach

Protected backups of all your CWP servers on a separate machine. Snapshots a hosting server cannot delete, and restore of files, databases, mail and whole accounts in the admin and user panel. Discuss in the forum

Backup Server ›
WordPress ManagerIncluded & freeWordPress managed from the panel

Install, secure, update, back up and clone WordPress sites without FTP. Updates are tested on a staging clone first and applied to the live site only when they pass, with a backup taken first. Discuss in the forum

WordPress Manager ›
CWP CageIsolationEvery account in its own cage

Per-account isolation built from Linux namespaces and cgroups. A break-in or a runaway script on one site cannot reach another account, the panel or the rest of the server; resource limits per hosting package. Discuss in the forum

CWP Cage ›
Script InstallerOne-click appsWordPress, Joomla, Moodle and more in one click

CWP’s own script installer in the user panel: pick an app, choose the domain and folder, and it is live in seconds with its database and admin login created automatically. Ready for LSPHP and LSAPI-Cache. Discuss in the forum

Script Installer ›
DNS ClusterFor every control panelOne DNS cluster for all your servers

Your servers keep creating domains as usual; the zones are collected into one authoritative PowerDNS cluster you control, with DNSSEC, roles and a full activity trail. Accepts CWP, cPanel, Plesk, DirectAdmin and BIND. Discuss in the forum

DNS Cluster ›
CWP BillingFree to useBilling and support system for hosting providers

Clients, services, invoices, payments, domains, server provisioning and support tickets in one place. All gateways, server modules and registrars are free, with free migration from WHMCS, ClientExec and Blesta. Discuss in the forum

CWP Billing ›
CWPproFrom $1.49 per monthEvery CWP feature unlocked

CWPpro is the professional version of Control Web Panel: all features, unlimited accounts, the latest CWP version and security fixes first. $1.49 per month or $11.99 per year. Discuss in the forum

Get CWPpro ›

creating new files causes 500 error

Started by jonathan1, August 12, 2017, 10:12:02 PM

Previous topic - Next topic

jonathan1

Every time I create a file through WinSCP, the new file returns a 500 error. Only after running "Fix permissions" for that user, does it get fixed.

How can I make sure that I don't have to run "fix permissions" every time I create a new file?

darkness

With what user you are logging through WinSCP? If you are logging in with root and creating files in /home/john/public_html/ you will always get the 500 error and you will always need to "Fix Permissions".
UNIX is a very simple OS, but you have to be a GENIUS to understand it ...

studio4host

if you want to have correct permissions than its recommended to upload files by using FTP and user credentials.
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

jonathan1

I'm uploading over WinSCH using my SSH login. Yes I'm logging in with the user for the website.

But each time I create a file, it causes a 500 error and I have to reset the permissions.

Is there a configuration issue in apache somewhere that has to be changed?

studio4host

are you using the username of the account owner for ssh connection ?

if you are using the account owner account for ssh then the only issue you still can have with the permissions is that the files have incorrect permissions.

please note that suphp requires permissions 755 for folders and 644 for files, having anything higher then this numbers will be invalid and rejected by suphp security.
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

jonathan1

thanks for the reply

I haven't done anything to the apache config, I'm using nginx + apache setup

What would I need to change in apache to ensure it doesn't keep happening?

yes, I'm logging in through SSH/WinSCP using the user/pass for the user the website is added to

studio4host

the best would be that you upload some file and then show stat from it, shell command:
stat FILENAME

and some output from the error_log file after opening the file in the browser
tail /usr/local/apache/logs/error_log
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

jonathan1

#7
[root@vps public_html]# stat NEWFILE.php
  File: 'NEWFILE.php'
  Size: 1               Blocks: 8          IO Block: 4096   regular file
Device: 800h/2048d      Inode: 257910      Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/jonathan1)   Gid: ( 1000/jonathan1)
Access: 2017-08-25 14:35:20.000000000 -0700
Modify: 2017-08-25 14:35:20.000000000 -0700
Change: 2017-08-25 14:35:21.639088638 -0700
Birth: -


AND

[Fri Aug 25 14:36:17.383950 2017] [:error] [pid 19070:tid 140564649391872] [client 23.240.188.50:51922] SoftException in Application.cpp:249: File "/home/jonathan1/public_html/NEWFILE.php" is writeable by group
[Fri Aug 25 14:36:17.383998 2017] [core:error] [pid 19070:tid 140564649391872] [client 23.240.188.50:51922] End of script output before headers: NEWFILE.php

jonathan1

I want to make sure I can fix this as an Apache level so when I create new users, this issue doesn't come up again. Thanks for all your help! I'll be subscribing to the upgrade soon, awesome work on this product

studio4host

this is an umask issue causing the files to have group writeable permissions, edit file "/etc/ssh/sshd_config"

find this line:
Subsystem       sftp    /usr/libexec/openssh/sftp-server
Changed it to
Subsystem       sftp    /usr/libexec/openssh/sftp-server -u 022

now restart ssh and try to login and upload files again
service sshd restart

to fix permissions for already uploaded files use this command
chmod g-w FILENAME





VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

jonathan1

Thanks for the instruction

I did that, I can't login via WinSCP anymore. getting this error

Cannot initialize SFTP protocol. Is the host running an SFTP server?

studio4host

have you added only " -u 022" at the end of the line ?
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

jonathan1

yes, is there a typo in the spacing? I copied exactly from your response.

https://www.screencast.com/t/Eo9fkC3eK

studio4host

this is how it needs to look
Subsystem       sftp    /usr/libexec/openssh/sftp-server -u 022
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

jonathan1

That did it! I can create new files now.

thank you!!!