Cannot change files permissions on server. Could this be because my site does not have a domain name? - permissions

I am developing a site for a client who has not decided on their domain name yet. I set up an account on a web server via WHM but have not pointed any domain names to it.
All was going well until I used a plugin (TinyMCE) to try and browse files on the server - it wouldnt work so I had a look at its script files and realised their permissions are set to not executable (644). I tired to change it to executable (755) but I get an error in my FTP clients console:
550 Could not change perms on file.js: Operation not permitted
Could this be because I am accessing the server not through a specific FTP account and so the server has locked down the files?
EG: I am using the servers IP address to access files with my FTP rather then something like:
ftp.mysite.com
Any advice on this would be great! Thanks

Yes, There is an issues with the FTP account permission. You will have to login your server with the main cPanel account user name and password OR you can chnage your file permission through cPanel >> File manager

Related

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

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

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.

Save and access file from shared drive

I am running a file upload process to upload files to a db. The web server and the SQL server are different machines. I am attempting to use an SQL OPENROWSET to upload an excel file, but I cannot determine how to get the file onto the other machine. Is there a way to set up a shared drive that the web server can save a file to and the SQL server can access? We have a local network set up with Active Directory.
For Example:
WebServer - Shared drive on web server under C:/inetpub/webpage/fileImport
SQLServer - Will log in with sql auth using USERID and PASSWD. Needs to access webserver shared drive.
What user do I share the drive on web server with so that the sql auth user will be able to access it when I run the OPENROWSET?
Any help will be much appreciated.
I am also trying the same thing by uploading the file in FTP and trying to access it. But i didn't get any progress from last 2 weeks.
And i had found may other alternatives like coping the files in another server and share the folder with out user name & password. then we can able to access it by giving the
\\folder\filename
If u get any other alternative plz share...
You should setup a new user that has access to the user group iis_users, and then give them security access to the file drive itself.
The same should be done to the DB server, and on the drive folder security the other user will need read/write/Modify permissions.
So it will look like:
(WebHost) ---- (Shared) ---- (DBHost)
*-------*
Well, you would setup the folder on the SQLServer.
Create a secure user on the SQL machine.
Make the folder shared (with modify rights for the secure user)
Map the Network drive on the Windows machine, using the secure user to access it.
Your main user on the SQLServer should then be able to openrowset from the local folder, whilst the IIS Server is remotely accessing it.
Using the OPENROWSET means that SQL qill access files using the service account. This account must be used to access share drive, as stated here Using SQL Credential to Open a file with OpenRowSet.

Giving permissions to a SQL Job to be able to access/modify folders and files on a different server

I have a sql job on SERVER01.
Part of the job is to access a folder located on a different server:
\\SERVER02\Files
I need to be able to create folders and files under it as well as modify/delete files.
The \\SERVER02\Files folder is being shared with several different accounts.
If I go to SERVER02 and try to UNC path to \\SERVER02\Files, it'll ask for a password.
Since the servers are in two different domains, I need to specify the domain for the account:
DOMAIN\accountName
password
Questions:
What is the correct way for me to set this up so that the job will have access to the other server so it can manipulate the files at \\SERVER02\Files ?
This is very confusing so I'm trying to get it right. Any help would be greatly appreciated.
Thanks.
We have this same issue in our own environment, because we have two domains that have to share resources. The technically correct solution is to setup a trust between the two domains so that user logins are mapped across the domains. If you're like us and can't setup a domain trust, you can try some of the following solutions:
Login under the account that the SQL job runs under on SERVER01, and use the Credential Manager to create a login to SERVER02 with the other domain's user / password.
Under the account that SQL job runs, create a network share to the UNC path with the credentials embedded: NET USE M: \\SERVER02\Files [password] /user:[domain\user]. You will have to make sure this path is always mapped before the job runs, and use M: for your path.
If you have a specific process/command you need to run that accesses the network path, you can start that particular process using runas to authenticate with the second domain's credentials: runas /netonly /user:[domain\user] "/path/to/mytask.exe". This prompts for the password, but that can be piped in with echo [password]|runas ...

Virtual Directory pointing to UNC share

I have an app that uploads documents to the server through the standard
When sent my application to the production server, I found out that they had the server load balanced. My solution to this was to place the upload directory into a network share and then create a virtual directory pointing to the share.
I have set permissions on the share and the file itself, but I keep getting "access denied" whenever I try to upload a document.
Where could I be missing permissions? Is it possible that IUSR needs to have access to the share?
Thanks.
FYI,
The answer to this solution for me was to setup temporary impersonation with a user account that had access to the share, the folder and the virtual directory.
Here's a link to the code that worked for me:
http://support.microsoft.com/kb/306158#4
I hope your site use anonymous access. Otherwise you will have a painful experience.
If it is so ( anonymous acess), then: The IUSR is a local user on the production servers and not a domain user. So it don't have access the the share. You will have to change that to a domain user ( in the site configuration and not on the application pool). And make sure that the application pool run on a network service ( this is the default ) and it should work.
Chances are that whatever your ASP.Net process is running as does not have access to the share.
So chances are you need to set up an IIS6 application pool to run as a domain user and have that domain user have access rights to the file share.
Don't forget to aspnet_regiis -ga {domainuser} so that the domain user can actually run asp.net applications.