cPanel - files are not showing in File Manager after copying via SSH / scp - cpanel

I have just purchased a dedicated server from a UK hosting company that uses cPanel and I have root access
I am using scp to copy a huge (> 2tb) website from another hosting company (1&1 IONOS using Plesk not that it should make any difference)
The files are copying over .. using SSH I can use the "ls" command to list all the files that I've copied over
However, when I use the File Manager option via cPanel interface, I can see the first folder name on the left hand side (i.e. public_html/my-copied-site) but on the right hand window it shows the directory as empty
If I use the "ls" command, I can see the files & folders
if I try an access any of the files directly via a web browser then I get a 403 Forbidden message
What have I done wrong?

The answer to this problem is the ownership of the folder
Using scp over SSH meant that I was logged in as "root" and therefore the owner of the folders was also "root"
Changing the owner of the folder (using "chown" command) to the account's name resolved the problem
Hope this helps someone out

Related

Download files from server with WHM

I use a server with WHM. I created monthly backup, it makes full server backup to /backup folder. I can create targz file with SSH, I know how to download gziped file with pscp, but I don't know how to download it from server with link in browser. I think it's possible, because sysadmin before me did it.
Can anybody help me with that?
You want to generate a link that you can access through your browser and will be served up by the web server? (your question is a little vague)
These files are stored out of the standard web directories so you could create a symlink in the public_html folder of your website to /backups and call it something obscure so it can't be easily scraped.
So for example public_html/my-secure-backup-folder can be a symlink to /backups.
Guide on creating a symlink here: https://www.namecheap.com/support/knowledgebase/article.aspx/9561/29/how-to-create-a-symbolic-link-in-cpanel
Easiest way to proceed:
Ssh to your WHM server then decide which cpanel account you need to backup. Create a full backup for that cpanel:
cd /home/cpaneluser/public_html
/script/pkgacct cpaneluser /home/cpaneluser/public_html
chown cpaneluser:cpaneluser /home/cpaneluser/public_html/cpmove-cpaneluser.tar.gz*
Then you can download the backup using your web browser by accessing your cPanel user's domain -> http://domain.tld/cpmove-cpaneluser.tar.gz
If you don't know the actual domain for that cPanel user you can do a cat /etc/userdomains | grep cpaneluser. It will show the configure domain for that account.
That would be all.
Alternatively you can login to the cPanel account using your web browser -> http://domain.tld/cpanel using the user/password combination for that cPanel account. There is a full backup function there (in the cPanel web interface) that does pretty much what I have explained earlier.

rsync copying from a server with differents permisions and owner

I'm trying to copy an entire folder with his content from a remote server to a new one, the remote server hasn't installed any pannel and new one has cpanel.
When I run the next instruction it looks to copy everything but it only has copied the folder and it's empty. The folder copied has permissions 700 like in remote but in new server the folders permissions are 755, of course the user and group are different.
I'm running this instruction with different options:
rsync -rlDv --no-perms --no-owner --no-group user#000.000.000.000:/home/user/public_html/folder /home/user/public_html/images/
I've used instead -rlDv -av with and without --no-perms --no-owner --no-group
Nothing works.
Any idea, thank you
Well, finally I've just fixed the problem.
The problem was that the files and folders was uploaded but I was seeing it with user own in cpanel and he can't see that files because the group and user was different, I changed in console to root and after change the owner and permissions to the same of the web and erything began to work fine.

SSH and FTP showing different files

I am using a host to try and deploy my Django site but I am confused by the SSH vs. FTP.
Background info:
I got the IP address, name and password from my host for the VPS.
I logged in using the same information via Putty and via WinSCP.
Both show me as having accessed root#[VPS IP Address].
Running ls on Putty shows nothing (no files or folders). So I created a file hello.txt.
WinSCP shows a lot of folders at the root, unlike Putty. I then searched all the folders for the hello.txt that I created and it's nowhere to be found.
Why would accessing the same VPS via two different methods show completely different things?
If you are indeed sure that you are logged into the same host, with the same user account you should check that you are in the same folder.
Using ssh you can issue the command pwd (print working directory) to view the current the directory you are in.
To change to another directory using the shell, use the cd command, for example:
cd .. # This moves up to the parent directory
cd /var/www/html
The Winscp user interface should also show you in what directory you are currently in.
Navigation to another directory using Winscp should be fairly straightforward.
There's no reason to think these methods will put you in the same directory location at all.
When you SSH in using Putty, you will almost certainly be put in your home directory, and that will be where your hello.txt was created.
But the FTP service has presumably been configured to put you in the common area where your service's files are located, which is not under your home directory. Where it is will be specific to the configuration of that machine.
Using SSH you will probably be able to use cd to change directory to the FTP location, if you can find out what it is; however, the reverse is not true and you almost certainly won't be able to navigate to the home directory via FTP.
(Note, this is not a question about Django, and should probably have been asked on ServerFault.)

Files owner on Joomla website

I need some suggestions about Joomla's files and folders ownership.
I'm working with a Joomla 2.5 website, hosted on a linux-apache server which hasn't suPHP module.
After one year of usage some files are owned by apache-user, and others by the ftp user.
I request to give the ownership of all files to the ftp user, but joomla (the apache user, after all) can't update system, install extensions or upload images.
How can i set the ownership of files?
Thank You
You will either need to talk to your hosting provider to change the file/folder ownership for you (which they should do), else if you are managing the server yourself , then you can do this using the following SSH command:
chgrp -R OWNER FOLDER
-R means recursive so it will also change the ownership for any sub directories and files
OWNER is the name of the server which you will need to add
FOLDER is simply the name of the folder you wish to apply this change to.
As for the command line tool, I like to use Putty
Hope this helps

Parallels plesk permissions accessing through FTP

Our server is running under CentOS 6 and handled over Panel Plesk 10.4.4. Structure of folders and files is created using php script. Then, when accessing through FTP we are unable to modify these folder contents previously created. When accessing it over Apache web user works without exception but not over ftp. Folders and files have 755 and 644 rights respectively. How to enable ftp acces? Thank you
EDIT: problem is that file owner and ftp are not the same but I do not know exactly how and where to attach it.
File and folders owner is psacln (gid 502) and group is apache (gid 503). Ftp users are not the same.
We add a login ftp user (also system one) to the group owner of files and folders "psacln" using usermod -a -G psacln ftpusername. Same procedure with apache group but problem persists.
The problem here would be that you probably run your site in mod_php mode. In this mode scripts are operated under Apache privileges, so all files and directories created are owned by Apache. This way the files cannot be accessed by your FTP user unless you set up 777 or 666 permissions.
I think your options could be
switch to FastCGI mode of PHP. Depending on your Plesk account privileges, you can either do it yourself in Plesk UI or will have to ask hosting provider for that.
This way your script will be operated under user privileges (same as FTP user) and there will be no problems with accessing these files through FTP. Also this option is often considered more secure.
make PHP script setting 777 permissions on your folders and 666 permissions on your files. It means you allow to modify them by everyone (so called "others"). So FTP user can modify these files as well. While this may sound insecure, but practically these files are already can be accessed from any other site on that system (if it is shared hosting server). So I don't think it will be any more insecure than the current status.
Regards